1. In Django parlance, a project is the final product, and it assembles one or more applications together.
  2. Manage.py is a pointer back to Django-admin.py with an environment variable set, pointing to your project as the one to read settings from and operate on when needed
  3. Settings.py is where you’ll configure your project. It has a few sensible defaults, but no database chosen when you start.
  4. Urls.py contains the URL to view mappings.
  5. Wsgi.py is a WSGI wrapper for your application.
  6. Beginning in Django 1.4, apps are placed alongside project packages.
  7. Models.py will contain the Django ORM models for your app.
  8. Views.py will contain the View code
  9. Tests.py will contain the unit and integration tests you write
  10. Django models map to a database table, and provide a place to encapsulate business logic. All models subclass the base Model
  11. The INSTALLED_APPS setting lists the applications that the project uses. These are listed as strings that map to Python packages. Django will import each and looks for a models there.
  12. By default Django will name your tables using a combination of the application name and model name.
  13. Django adds an id field as the primary key for your model, unless you specify a primary key.
  14. The syncdb manage command creates the tables in your database from models.
  15. The model Manager allows you to operate on the collection of instanes: querying, creating, etc
  16. Write unit tests for methods you add to the model
  17. The test manage command runs the unit tests.
  18. Django Views take an HTTP Request and return an HTTP Response to the user.
  19. Any Python callable can be a view. The only hard and fast requirement is that it takes the request object (customarily named request) as its first argument.
  20. Generic Views have always provided some basic functionality: render a template, redirect, create or edit a model.
  21. The URL configuration tells Django how to match a request’s path to your Python code. Django looks for the URL configuration, defined as urlpatterns, in the urls.py file in your project.
  22. By default Django will look for templates in applications, as well as in directories you specify in settings.TEMPLATE_DIRS.
  23. Most generic views that do form processing have the concept of the “success URL”: where to redirect the user when the form is successfully submitted.
  24. The collection of values available to a template when it’s rendered is referred to as the Context. The Context is a combination of information supplied by the view and information from context processors
  25. Django has two tools that are helpful for writing unit tests for views: the Test Client and the RequestFactory
  26. The TestClient takes a URL to retrieve, and resolves it against your project’s URL configuration. It then creates a test request, and passes that request through your view, returning the Response.
  27. Django supports adding static files at both the application and project level. Where you add them sort of depends on how tied to your specific assembly of apps they are.
  28. App specific static files are stored in the static subdirectory within the app. Django will also look in any directories listed in the STATIFFILES_DIRS setting.
  29. Django distinguishes between static site files, and user upload media.
  30. The staticfiles app is included to help manage static files and serve them during development.
  31. Static files can be included with apps, or with the project.
  32. Templates can extend one another, using block tags.
  33. A Django Form is responsible for taking some user input, validating it, and turning it into Python objects.
  34. Initial is a dictionary of values that will be used as the default values for an unbound form
  35. Forms have two different phases of validation: field and form. All the fields are validated and converted to Python objects (if possible) before form validation begins.
  36. Form validation takes place in a form’s clean() method
  37. Forms take user input, validate it, and convert it to Python objects.
  38. Django provides 3 types of fields for relating objects to each other: ForeignKey for creating one to many relationships, ManyToManyField for relating many to many, and OneToOneField for creating a one to one relationship.
  39. A FormSet is an object that manages multiple copies of the same Form(or ModelForm) in a single page.

最新文章

  1. py2exe
  2. Mininet的内部实现原理简介
  3. 打磨程序员的专属利器——命令行&界面
  4. Codeforces Round #343 (Div. 2) E. Famil Door and Roads
  5. LDA Gibbs Sampling
  6. (step 8.2.13)hdu 1524(A Chess Game)
  7. SparkStreming之updateStateByKey
  8. android:自己定义组合控件Weight(高仿猫眼底部菜单条)
  9. linux下nginx【反向代理】配置【负载均衡】配置
  10. Python入门5(pandas中merge中的参数how)
  11. spring cloud gateway - RequestRateLimiter
  12. MySQL utilities介绍&出现 No module named utilities
  13. java图片压缩(Thumbnails)
  14. CentOS7安装maven3.6.1
  15. LeetCode题解之Univalued Binary Tree
  16. 深入理解Linux内核-信号
  17. 解决打开visio2013提示windows正在配置的问题
  18. 使用spring的aop监听所有controller或者action日志
  19. JS-鼠标跟随块(一个小圆点跟着鼠标跑)
  20. cogs930找第k小的数(k-th number)

热门文章

  1. rhel7 ifconfig command not found
  2. SteveY对Amazon和Google平台的吐槽
  3. java操作redis。jedis使用api
  4. wget for windows
  5. 下载必要的android sdk
  6. linux 安装 Headless Chrome
  7. Android 架构师技能图谱(转载)
  8. DBUtils查找最大的ID总是返回0
  9. ios--网页js调用oc代码+传递参数+避免中文参数乱码的解决方案(实例)
  10. ios 关于屏幕旋转和屏幕晃动