Django configuration environment variable

Copyright: bloggers without consent, is prohibited reprint. Thank you! https://blog.csdn.net/cp_123321/article/details/85330509

 

A. Create a Django project

1. Create a Django project in pycharm

2. Configure the path to the virtual environment, and then create

3. will appear a pop, select the first (open a new pycharm)

4. Switch Terminal in to Django virtual environment (find the directory you just installed a virtual environment, enter Scripts, copy the path)

5.

Cut into the virtual environment, (if this command does not run, you need to check whether they have cut into the directory of your project) and then do

python manage.py runserver

At this point you can only access the ip (http://127.0.0.1:8000), the default port number 8000, can perform 

python manage.py runserver 0.0.0.0:8000

 

At this time, other hosts on the same network can also access your office website (http://0.0.0.0:8000)

Run this command, at step 4, you can ensure that the project is running current,

6. pycharm until after the installation is complete, and after loading is complete, click on the upper right corner

7. Wait until the following screen, click on this link to go, even if the following interface installation, activation was successful

The following screen appears on your browser:

 

II. Create a project

8. Create a project (to open a new page)

Execute the following command to create a new app projects

python manage.py startapp MySite
#MySite 是项目名称,自定义的

9. At this time there will be a file in your directory MySite

Directory files under the action of MySite

admin.py Administration File

apps.py application settings file

models.py model file

Unit tests test files

views view file

Note: When you run the project, you must perform step 6, 7 (or run step 5), or URL (page) you write is not accessible.

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/cp_123321/article/details/85330509