First, install
General installation can use cmd
pip install django // This is the latest version pip install django == 2.0.2 (custom installation 2.0.2 version)
Manual installation by downloading way
django official website: https://www.djangoproject.com/
python official repository: https://pypi.python.org/pypi/Django
Second, the configuration uses
1 by cmd create a new project, I was new in the desktop
The above command pythonDjango new folder on the desktop, which is generated in two files below
manage.py: command-line tool, you can use a variety of ways to interact with the django project;
In pythonDjango folder there are four .py file
__init__.py: let Python to the directory as a standard development kit;
settings.py:django project profiles;
urls.py:django project URL configuration file;
wsgi.py:wsgi Python language is defined by a web server, a service interface provided by the project;
2, create a running application
New Application pythonWeb by cmd in the root folder pythonDjango
In pythonWebweb folder inside a folder 5 .py file
migrations folder: recording data changes in the models;
admin.py: map data to the admin models in the background;
apps.py: configure the application to create, such as the new file;
models.py:Django model file, create a data table model of the application;
tests.py: create test cases;
views.py:Django view file, the contents of the front page to the control transmission;
There are three files, are now below the root folder pythonDjango
PythonDjango open cmd in the root folder, run the command python manage.py runserver localhost: 8010
The default is to use port 8000, there is a change
In the browser input http: // localhost: 8010 / you can see the following on the success of
Note: If you want other computers can also access this page, execute the following command:
python manage.py runserver 0.0.0.0:8010
The IP address 0.0.0.0 tells the server to listen for any network interface. In this way, other computers in the local network can be accessed via the IP address of the server page in a browser.