Create a python framework -django-01 project

1. Create a virtual environment

  mkvirtualenv django_study -p python3

  Once created: (django_study) python @ ubuntu: ~ $ 

2. Install django- specified version 1.11.11

  pip install django == 1.11.11 given: TypeError: unsupported operand type (s) for - =: 'Retry' and 'int', because the source of the problem

  pip install django==1.11.7 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

  Successfully installed django-1.11.7 pytz-2019.3: Installation successful

  pip uninstall django == 1.11.7 Uninstall 1.11.7 version of django

  pip install django == 1.11.11 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com installation of django 1.11.11

  Successfully installed django-1.11.11

3. Create a django project in the desktop folder django_study

  (Django_study) python @ ubuntu: ~ / Desktop / django_study $: from the virtual environment to the specified directory cd

  (Django_study) python @ ubuntu: ~ / Desktop / django_study $ django-admin startproject dj_study: Create a project (named dj_study)

  

   . Folder is django_study

  dj_study is the project name

  dj_study is the project of the same name directory

  setting.py: The overall project profiles, settings, middleware, database configuration and so on.

  wsgi.py: WSG project is compatible with the web server interface

  manage.py project document management, project management: terminal starts project to python manage.py runserver ip: port

4. Start project

  cd to the directory where manage.py, python manage.py runserver to start the program

  After the start terminal displays:

  

  Enter 127.0.0.1:8000 browser browser displays:

  

  Appears above even a show: show the success of the project up and running:

    Note : django default modal work in Debug mode, if you add, modify, delete the file, the server will automatically restart.

 

Guess you like

Origin www.cnblogs.com/meloncodezhang/p/11713220.html