Django Stand Process Summary:
1. Django-admin Startproject Store
2, store this project directory under: __init__,manage,setting,urls
3, setting inside the focus:
A. Configuration database (Engine,name,use,passwd,port,host), in SQLite, for example, fill in Sqlite3, created db (Modify: Do not create the database in advance)
B.language,time_zone
C.installed Apps: Install Django.contrib.admin and other management tools, Store.shoes (your app)
D.middleware_classes is dependent on the installation of the management tool
What to do First: (Modify: Do not create the database in advance) a. Create a db with Sqlite3: Enter the store directory, create the database folder, initialize the DB with Sqlite.exe name.db in cmd, and create the initial table to save the DB. CREATE table User (' User name ');create a table;Usesqlite3 The user command to enter the user database. B. Edit the views and models under the app before installing
4.app Views: Defines the function to be displayed (it is a bit like HTML, it is called in the URLs)
5.app Models: Defining the Data class
6.urls.py:
From Django.contrib Import admin
From project.app.views Import function
......
Configure the URL inside the patterns
URL (r ' ^store/', printinfo),
7.template
Django encounters a problem:
1, django-admin Startproject ...
Encountered an error, promptingpkg_resources. distributionnotfound:django==1.7.1,
because 2 django,django-admin were installed to invoke the latest Django.
Solution:
When input django-admin startproject ... When Django passes the Python27/scripts/django-admin.exe
Call D:\Python27\Lib\site-packages\django\bin inside the django-admin.py (that is, scripts inside the django-admin.py)
There are four files in script Django-admin.exe, Django-admin.exe.manifest, django-admin.py, django-admin-script.py
Can do this:
1. Delete two EXE files
2. Modify the django-admin-script.py version number for example, and change the 1.7.1 into 1.3.1.
Of course, you can also delete the four files, and then reload. Sqlite3:sqlite3 sq.db enters this database. Help. Tables lists all tables. The schema list is listed in the table structure select * from table name; Query _______________
Http://m.51cto.com/?src=www.51cto.com%2fart%2f200906%2f130158.htm#m/www.51cto.com/art/200906/130158.htm Django Overall Architecture:
By putting all the pieces together, the HTTP requests received are forwarded by the Web server to Django,django to accept them at the requested middleware layer. The views are then assigned to the appropriate view based on the urlconf pattern match, and the view performs the core part of the desired work, generating the response as needed with the model and/or template. The response then passes through the middleware layer for final processing, and finally returns the HTTP response to the Web server and forwards it to the user.
Python reading notes-django stand process summary (from the Django book)