zoukankan      html  css  js  c++  java
  • a little summary of Django

    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.
  • 相关阅读:
    C语言指向指针的指针
    C语言注意事项
    C语言指针
    C语言字符串
    C语言数组
    C语言交换两个数的值
    C语言位运算符
    C语言各种进制输出
    C语言中各种进制的表示
    C 语言sizeof运算符
  • 原文地址:https://www.cnblogs.com/linghuaichong/p/4112429.html
Copyright © 2011-2022 走看看