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.

<Effective Django>读书笔记的更多相关文章

  1. csapp读书笔记-并发编程

    这是基础,理解不能有偏差 如果线程/进程的逻辑控制流在时间上重叠,那么就是并发的.我们可以将并发看成是一种os内核用来运行多个应用程序的实例,但是并发不仅在内核,在应用程序中的角色也很重要. 在应用级 ...

  2. CSAPP 读书笔记 - 2.31练习题

    根据等式(2-14) 假如w = 4 数值范围在-8 ~ 7之间 2^w = 16 x = 5, y = 4的情况下面 x + y = 9 >=2 ^(w-1)  属于第一种情况 sum = x ...

  3. CSAPP读书笔记--第八章 异常控制流

    第八章 异常控制流 2017-11-14 概述 控制转移序列叫做控制流.目前为止,我们学过两种改变控制流的方式: 1)跳转和分支: 2)调用和返回. 但是上面的方法只能控制程序本身,发生以下系统状态的 ...

  4. CSAPP 并发编程读书笔记

    CSAPP 并发编程笔记 并发和并行 并发:Concurrency,只要时间上重叠就算并发,可以是单处理器交替处理 并行:Parallel,属于并发的一种特殊情况(真子集),多核/多 CPU 同时处理 ...

  5. 读书笔记汇总 - SQL必知必会(第4版)

    本系列记录并分享学习SQL的过程,主要内容为SQL的基础概念及练习过程. 书目信息 中文名:<SQL必知必会(第4版)> 英文名:<Sams Teach Yourself SQL i ...

  6. 读书笔记--SQL必知必会18--视图

    读书笔记--SQL必知必会18--视图 18.1 视图 视图是虚拟的表,只包含使用时动态检索数据的查询. 也就是说作为视图,它不包含任何列和数据,包含的是一个查询. 18.1.1 为什么使用视图 重用 ...

  7. 《C#本质论》读书笔记(18)多线程处理

    .NET Framework 4.0 看(本质论第3版) .NET Framework 4.5 看(本质论第4版) .NET 4.0为多线程引入了两组新API:TPL(Task Parallel Li ...

  8. C#温故知新:《C#图解教程》读书笔记系列

    一.此书到底何方神圣? 本书是广受赞誉C#图解教程的最新版本.作者在本书中创造了一种全新的可视化叙述方式,以图文并茂的形式.朴实简洁的文字,并辅之以大量表格和代码示例,全面.直观地阐述了C#语言的各种 ...

  9. C#刨根究底:《你必须知道的.NET》读书笔记系列

    一.此书到底何方神圣? <你必须知道的.NET>来自于微软MVP—王涛(网名:AnyTao,博客园大牛之一,其博客地址为:http://anytao.cnblogs.com/)的最新技术心 ...

  10. Web高级征程:《大型网站技术架构》读书笔记系列

    一.此书到底何方神圣? <大型网站技术架构:核心原理与案例分析>通过梳理大型网站技术发展历程,剖析大型网站技术架构模式,深入讲述大型互联网架构设计的核心原理,并通过一组典型网站技术架构设计 ...

随机推荐

  1. 【转】C# 的 IDisposable 接口

    C# 的 IDisposable 接口 我在微软的团队快被微软 C# 里面的各种 IDisposable 对象给折腾疯了…… 故事比较长,先来科普一下.如果你没有用过 C#,IDisposable 是 ...

  2. [Golang] 从零开始写Socket Server(1): Socket-Client框架

    版权声明:本文为博主原创文章,未经博主允许不得转载. 第一次跑到互联网公司实习 ..感觉自己进步飞快啊~第一周刚写了个HTTP服务器用于微信公共号的点餐系统~ 第二周就直接开始一边自学Go语言一边写用 ...

  3. unity, Collider2D.attachedRigidbody

    boss根节点上挂RigidBody2D(且boss根节点以下任何子节点均不挂RigidBody2D),boss腿部骨骼节点挂collider2D,标签为"bossLeg",bos ...

  4. elasticsearch 性能监控基础

    一.Elasticsearch 是什么 Elasticsearch是一款用Java编写的开源分布式文档存储和搜索引擎,可以用于near real-time存储和数据检索. 1.Elasticsearc ...

  5. ELK 中的elasticsearch 集群的部署

    本文内容 背景 ES集群中第一个master节点 ES slave节点 本文总结 Elasticsearch(以下简称ES)搭建集群的经验.以 Elasticsearch-rtf-2.2.1 版本为例 ...

  6. MySql(十二):MySql架构设计——可扩展设计的基本原则

    一.前言 科技在发展,硬件设备的发展渐渐无法满足应用系统对处理能力的要求.不过,我们还是可以通过改造系统的架构体系,提升系统的扩展能力,通过组合多个低处理能力的硬件设备来达到一个高处理能力的系统,也就 ...

  7. Spring Security教程(六):自定义过滤器进行认证处理

    这里接着上篇的自定义过滤器,这里主要的是配置自定义认证处理的过滤器,并加入到FilterChain的过程. 在我们自己不在xml做特殊的配置情况下,security默认的做认证处理的过滤器为Usern ...

  8. vue-client脚手架使用

    1.必须安装node环境 2.安装vue-client脚手架,在命令提示符中运行npm install -g vue-cli 3.创建项目 vue init 模板名 项目名 例如:vue init w ...

  9. amazon建立基于centos的ec2

    在amazon上建立centos系统的ec2,主要就是系统要找对. 1.登录网址:amazonaws-china.com,注意这个网址是专门为在国内建立国外通用亚马逊ec2设立的,其他的是用国内的ec ...

  10. 对于在Android Studio 的 build.gradle 中的默认applicationId 要不要写呢?

    起因 刚完成一个版本的开发.刚上Google play 就有用户反映无法更新应用.错误代码为:Can't install app "****" can' be installed. ...