Django entry

1, enter the virtual environment

source ENV/bin/activate

2. Create a django project

django-admin startproject test1

  

   __init__.py: Description tets1 is a python package

   setting.py: project configuration files

   urls.py: configure the router's url

      wsgi.py:web Django server and interact entrance

 manage.py: project management documents

3, Django development, a functional module implemented with an application,

A project by a number of applications, each application to perform a specific function

  Creating an application's commands:

    python manage.py startapp application name

  Note: Create an application is required to enter the project directory

  

  __init__.py: Contents is a Python module

  Content writing and database project: models.py

  views.py: receiving a request, a process, and to interact with the T M, returns a response.

  Defining processing functions, view functions .

  tests.py: write test code file

  admin.py: Website background management related documents

  

4, establish links between applications and projects, the need for the application to register

  Enter the settings, py

  In INSTALLED_APPS: add a corresponding item name

5, start the web server

  Command: python manage.py runserver

 

Guess you like

Origin www.cnblogs.com/simon-lzx/p/12529391.html