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