10. Build and use the Django Development Environment

Source: Internet
Author: User
Tags install django

Django is a python-based framework. Therefore, you must first install the python environment. For the python environment setup, you have previously written it. For more information, see http://www.the5fire.net/python-env.html. With the python environment, install Django.

Before getting started, we should first introduce what the Django development environment includes:

  • 1. Install Django
  • 2. Install MySQL [not required, this article will mention]
  • 3. install Apache [not required]

In addition, it is mainly used with everyone to use Django as the Todos server, so we also briefly introduce how to use Django for development.

Officially started, install Django is quite simple, to this: http://www.djangoproject.com/download/1.3.1/tarball/ I use the Django version is 1.3.1, you can choose on your own.

After the download, go to the Django-1.3.1 directory through the command line and execute: Python setup. py install (SUDO may be required for Ubuntu users ). Enter Django-admin in the command line to see if there is a wooden prompt, if not you need to go to your corresponding C:/python2.7/scripts to see if there is a django-admin.py file, if there is, you need to put this directory in the system environment variable.

Let's take a look at the installation of MySQL. [MySQL is not used for the Todos project]

Windows user installation is relatively simple, first MySQL database installation package, then download the corresponding MySQL-python-1.2.3.win32-py2.7 Installation File, first install MySQL, then install the corresponding mysql-Python file.

For Ubuntu users, perform the following operations:

1. Install MySQL

Sudo apt-Get install mysql-Server

Sudo apt-Get install libmysqld-Dev

Sudo apt-Get instlal libmysqlclient-Dev

Sudo apt-Get install libmysqld-Dev

Sudo apt-Get install libmysqlclient-Dev

Sudo apt-Get install libmysqlclient-Dev

2. Configure MySQL and Python

Sudo apt-Get install Python-mysqldb

You can also refer to my previous article: http://www.the5fire.net/python-opt-mysql.html

Now, the environment has been set up and can be used simply.

First, create an application anywhere, command: django-admin.py startproject Todos, then you will find that there is a todos folder, in the file where you execute the command. This is a todos project. Switch to todos and execute Python manage. py runserver. The command line outputs the Django version and server URL. You can see it in your browser. See the following page:

This article introduces Django installation, MySQL installation, and simple use of Django. The next article begins to change the previously analyzed todos to a program that requires interaction with the background web server.

Link: http://www.the5fire.net/10-django-dev-env.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.