1.2 building Django environment and creating projects in two ways

Time:2021-1-27

1. Django download and environment variable configuration:

1> Command line download: PIP install Django = = 1.11.18 – I https://pypi.douban.com/simple/

2> Environment variables: C: Python 3.5: lib: site packages: Django: Bin- admin.py )

Python environment variable: C: \% Python 3.5 \ \% scripts

 

2. The first way to create a project is to create a project from the command line and any directory of your own (creating a project from the command line will lack the app directory and templates directory)

1> Create project command line: Django admin startproject_ pro

2> . create app command line:

 

3> . configuring settings

 

 

 

4> . start the project

1) . command line: switch to the project root directory (first_ pro)  
python manage.py runserver # 127.0.0.1:8000
python manage.py runserver 80 # 127.0.0.1:80
python manage.py runserver 0.0.0.0:80 # 0.0.0.0:80
2) Pychar: don’t right-click the green triangle

 

 

 

This is as follows: MySite = first_ pro

 

3. Project creation method 2: pychar creates a second project (project name > environment configuration > Templates and APP)

1> Refer to the creation of the following picture

2> Configure Python running environment

 

 

 

 

 

3> Run the following button, which is equivalent to command line execution: Python manage.py runserver # 127.0.0.1:80