First, the Environment version information:
Operating system: WINDOWS10
Django Version: 2.0.5
Python version: 3.6.4
Second, create a virtual environment:
1. Why to create a virtual environment:
We want to develop a new project that requires a separate Python runtime environment. If Project a uses a different version of the environment than project B, creating separate virtual environments for project A and B will not interfere with each other .
2, to create the prerequisite to install Virtualenv:
PIP3 Install Virtualenv
3. How to create:
(1), create a new folder named Demo
(2), enter the folder to open the command line. (shift+ right mouse button)
(3), enter at the command line: python-m venv my_venv A complete Python environment is generated in scripts under the newly created My_venv folder.
Third, install Django:
1. my_venv folder under Scripts Enter the command line (shift+ right mouse button) or input from the previous step command line: CD my_venv/scripts enter into the Scripts folder with the command line: Activate is used to activate the virtual environment.
2. Install Django and enter it on the command line: PIP3 install Django
Iv. creation of the project:
1. Create a Django environment and enter it at the command line on the previous step: Django-admin Startproject my_project The Django project folder appears under the Scripts folder.
2, create the project name for the app, command line into the My_project folder input: Python manage.py startapp app in the My_project folder will appear under the app folder
3. Run the project: Enter in the command line: Python manage.py runserver
For example, the arrow refers to the local URL: The Http://127.0.0.1:8000/project URL, and Http://127.0.0.1:8000/admin is the Django-brought background management interface
Build a Django project under the Windows system