Django project: Project Environment Building — I. creating Django project

Time:2019-10-20

Project environment construction

I. create Django project

1. Create a python virtual environment

Create a python virtual environment on the virtual machine, because the actual project deployment, the real Linux

mkvirtualenv -p /usr/bin/python3.6 tzproject

2. Create Django project

1. Install Django

Choose to install the latest version 2.1.10 of Django 2.1. X

pip install django==2.1.10

2. Create Django project

Cd ~ / project / ා CD to the place where you want to put Django project path
django-admin startproject tzproject

3. Create pycharm project

Through the remote project of pycharm, connect the virtual machine and develop it.

1. Select project directory

Select the directory where you want to store project files. Note that the root directory of Django project and pycharm project must be consistent. Do not use one pycharm project to manage multiple Django projects.

2. Configure remote interpreter

Configure the virtual interpreter you just created

 

3. Configure remote project path

 

4. Set synchronization configuration

 

 

 

 

 

 

 

 

 

 

 

 

5. Download code

 

 

 

 

4. Pycharm configuration Django project

After the code is downloaded, you need to configure the project as Django project in pycharm, so as to use various convenient prompt functions of pycharm.

 

 

 

 

 

 

 

 

 

 Do a good job of virtual machine port mapping and input in the browserhttp://127.0.0.1:8000You should see the following picture