Python: Install django and create a project. pythondjango Project
The example below is carried out in python2.7, And the python3.X operation is the same (and environment configuration can be omitted)
View pip version
Install django. "1.10.3" is the version number of django.
After successful installation, you will see the django_admin.exe file in the directory.
View django version
Configure Environment Variables
Add the python path and django path to the system environment variables respectively.
- D: \ Python27
- D: \ Python27 \ Lib \ site-packages \ django \ bin
- D: \ Python27 \ Scripts
Enter the "django-admin" command in the windows Command Prompt and press enter to display the commands provided by django.
Create a folder, and then start creating a project. Run the startproject command.
After the creation, open NsDs. The following describes the directory (refer to the cainiao tutorial)
|-- NsDs| |-- __init__.py| |-- settings.py| |-- urls.py| |-- wsgi.py-- manage.py
- Manage. py is a practical command line tool that allows you to interact with this Django project in various ways.
- An empty NsDs/_ init _. py file tells Python that the directory is a Python package.
- NsDs/settings. py the settings/configurations of this Django project.
- NsDs/urls. py the Django project URL Declaration; a Django-driven website "directory ".
- NsDs/wsgi. py a wsgi-compatible Web server portal to run your project.
View commands provided by manage
Start the service: run the runserver command. The default address is "127.0.0.1: 8000"
You can also specify the address
python manage.py runserver 127.0.0.1:8001
If the startup is successful, enter the address in the browser, as shown in:
Enter "127.0.0.1: 8000/admin" (admin is a built-in Background Management System of Django .)