django preliminary understanding of (a)

Install django

  pip3 install django == version number

Creating a project djangp

  django-admin startproject project name

Contents Introduction:

  

Run django project:

  python manage.py runserver 127.0.0.1:8080

Template file configuration:

  

Static configuration file:

  

To disable the beginning csrf middleware in the configuration file for easy submission form information, or will be error

Django basic three-piece

  

HttpResponse

  Inside pass a string parameter and returns to the browser

  E.g:

  

render

   In addition to the request parameter also accepts a template file to be rendered and a preservation of specific dictionaries parameters.

  Listen ah burst into the data template file, and finally the results back to the browser (exhausted me ask jinja2 used above)

  

redirect

  Receiving a url parameter indicates the jump to a specific url

  

 

 note:

  Start django error:

  

 

Guess you like

Origin www.cnblogs.com/yangzhaon/p/11110805.html