The environment used is the Windows operating system, the Python environment is 3.6,django is the latest version of 1.10.6 on the official web, this article describes how to install Django with the PIP management tool after installing Python, as well as Django project creation, Project startup.
If your computer is not installed Python,windows installation method is very simple, only need to go to the official website to download the installation package, double-click EXE installation can be, note that after the installation is complete, tickAdd Python 3.6 to PATH 选项,勾选会自动添加python的执行文件的路径至环境变量,否则就要手动进行添加。具体参考:python的安装
After the Python installation is complete, install the PIP Package Management tool, the latest version is 9.0.1. Pip is a tool for installing and managing Python packages, and the tools for Python installation packages are Easy_install, Setuptools, Pip,distribute. Using these tools, you can download and install Django. , while Pip is a substitute for easy_install. The official https://pypi.python.org/pypi/pip/#downloads
Download complete, unzip, find the path to the file, here is the D:\pip-9.0.1
1. Install PIP Package Management tool:
Before this, the introduction of Windows under the use of console access to file path, Linux access to a specific directory, direct use of "Cd/path", but under Windows need to enter the letter you want to access, before you can use "Cd/path" to navigate to a specific directory. To access the Blogs folder under the E disk, you need to locate the E-drive and then use "CD blogs", where the file path is D:\pip-9.0.1
Locate the D drive first:
Navigate to Folder:
Enter the command:
Python setup.py Install
Install the finished interface:
2, the installation of Django, with the PIP, you can easily install Django.
Very simple to use commands
Pip Install Django
My computer has been installed, so the display has been installed, not installed waiting for the installation to complete.
3. Create a project using Django: Using commands
django-admin.py Startproject MySite
Django, which is installed with PIP, automatically adds environment variables, so it can be a lot less cumbersome to install, and manual installation requires adding environment variables manually.
Such a project was created successfully.
It is not recommended to install to the C drive, it should be installed to another drive letter, here is just a demo.
In the current directory, the MySite folder is generated. Its file tree structure is as follows:
Mysite├──manage.py└──mysite ├──__init__.py ├──settings.py ├──urls.py └──wsgi.py
4. Start the Django service:
Go to the folder where the project is located:
To start the Django service:
Python manage.py Runserver 8000
A bit of a problem, very normal, according to the prompt, we re-enter:
Python manage.py Migrate
Re-open the service:
Python manage.py Runserver 8000
The server port is open, and Django has started the service: we open it in the browser. READ: Default access Path 127.0.0.1:8000
At this point a Django project is created successfully and started.
installation, configuration, and startup of Django in Python version 3.0 under Windows