django_ installation, create a startup

python django is a heavyweight server-side development framework, we can use it to develop some back-end services and websites

First, install django

pip install django==2.1.5

Second, create, start project

1, the command creates:

django-admin startproject project_name # Create a project
cd project_name
python manager.py startapp user # 1 to create subprojects
python manager.py startapp order # Create a subproject 2

django-admin command after the installation is complete there will be a django, django installation is successful if no django-admin commands, check the installation of python scripts directory of whether to join the environmental variables

Two, pycharm created:

File --- New Project --- Django, fill in the project name, application module name to the following:

 

 After creating the command:

python manager.py runserver # starter project

Access to complete the run inside the browser 127.0.0.1:8000 you can see the project running

After the completion of projects and applications to create, and then create two directories, templates and static, templates put html files, static discharge static files, js and css files, directory structure like this, as shown below:

 

Three, django common configuration changes

Here are some common configuration, you need to modify (settings in the project directory)

 

Guess you like

Origin www.cnblogs.com/lsl1230/p/12129684.html