1. Installing Django
If you do not have Python installed, you need to install python,django1.6 for 2.6,2.7,3.2 or 3.3, which is python2.7.8
Then install Django, the release version has been updated to 1.6.6, download in https://www.djangoproject.com/(if the old version is installed, you need to delete the old version first)
Installation method win, first unpack the Django package, and then run the Python setup.py install wait for the installation is ready (you need to set the Python environment variable, setup.py in the directory after Django decompression, you can go to this directory and then install or give setup.py the available path. PS: can also be installed quickly with PIP or Eazy_install)
Some of the other non-absolutely necessary: database-Related: MySQL + mysql-python. Development environment Eclipse + Pydev
2. Create the Project
Create a project you can enter Python manage.py startproject on the command line Port Project_Name
Create an app to enter Python manage.py startapp on the command line Port app_name
Run Test server can enter Python manage.py runserver port on command line ports
These methods can be easily executed under eclipse. Pydev comes with the creation of a Django project. Adding apps can also be done by right-clicking on the project name and in the Django options, which is a lot easier.
3. Django Basic files and configuration
After the project is created, manage.py, nichijou/__init__.py, nichijou/settings.py, nichijou/urls.py, and nichijou/wsgi.py are automatically generated. Nichijou is a project name I built.
Settings.py is the Django configuration information
MySQL Database configuration:
The variables in settings.py are configured in the database as:
1 DATABASE = {2 ' default ' = {3 ' ENGINE ': ' Django.db.backends.mysql ', 4 ' NAME ': ' Nichijou ', 5 ' USER ': ' meamin9** ', 6 ' PASSWORD ': ' ******* ' }10}
Name is the database name. It's almost like this today.
[Django Learning 0-1] Django + Eclipse Basic Environment