标签:des style blog http io ar color os sp
url routing mechanism
url name/namespace
We can name a url pattern in urls.py, and reference this name to generate a url in other places. This ensures no hard-coded url. Read the django tutorial for details. (search "Removing hardcoded URLs in templates")
ORM
concept: schema migration
Each time data model is changed, django can generate a migration to record this change and apply it to the database schema.
Suppose two developers are working on the same django project, they have theire own local databases and own test data in dbs.
1. One day, A changed a table schema, and submits his codes into git.
2. B pulls down the newest codes, generate migrations, apply migrations to his own database.
3. This way, B‘s test data is not affected. Without schema migrations, B has to do data migration himself:
export test data=>drop old table=>create table using new schema=>import test data
Read the django tutorial for details. (search "Creating models")
project and app
referenced from django tutorial:
What’s the difference between a project and an app? An app is a Web application that does something – e.g., a Weblog system, a database of public records or a simple poll app. A project is a collection of configuration and apps for a particular Web site. A project can contain multiple apps. An app can be in multiple projects.
标签:des style blog http io ar color os sp
原文地址:http://www.cnblogs.com/linghuaichong/p/4112429.html