Notes for Studying Django
- Once you added a new application to INSTALLED_APPS, the database tables need to be updated, thus you need to run python manage.py syncdb.
- Normally the server auto-reloads code every time you modify a file, but creating a new file does not trigger the auto-reloading logic. If a new file is added you need to restart the development server by using python manage runserver.
- The url() function is passed four arguments, two required: regex and view, and two optional: kwargs, and name.
- Each view is responsible for doing one of two things: returning an HttpResponse object containing the content for the requested page, or raising an exception such as Http404.
Notes for Studying Django的更多相关文章
- Python Django Learning Notes..
The first time I came across django was last month.. Since then I was considering it as the better c ...
- django notes 七:Using Forms
form 也没什么可说的,我只给一个例子大家就懂了 form model from django import forms class UserForm(forms.Form): username = ...
- django notes 六:数据库 CRUD 操作
CRUD 也没什么可说的,django 提供了完善的 orm api, 直接用就行了. 我只贴几个列子,一看就明白了,自己再用用就熟了. # create b = Blog(name='Beatle ...
- django notes 五:Writing models
models 其实也没什么好说的,就是普通的 python 类 settings 中配置数据库连接 DATABASES = { 'default': { 'ENGINE': 'django.db.ba ...
- django notes 四: Writing views
views 其实没什么可看的, 在 django 中 views 就是 controller, 是处理请求的, 就是一个普通的 python 方法. 一般从 request 中提取请求参数, 然后 ...
- django notes 三:Template 的查找
django 中有 2种 Template Loader django.template.loaders.filesystem.Loader django.template.loaders.app_d ...
- django notes 二:URL dispatcher
一般在 settings.py 中会有一个 ROOT_URLCONF ,请求到来时 django 会从 ROOT_URLCONF 指向的文件中查找 urlpatterns 变量配置的路由. url ...
- django notes 一:开篇
公司 web 框架用的是 django, 以前没用过,打算这两周好好看看. 边学习边整理一下笔记,加深理解. 好像谁说过初学者更适合写入门级的教程,我觉得有一定道理. 高手写的教程有一定深度,不会写入 ...
- Django notes III: Dynamic filtering
EXTRACTED from the Django document It's a common need to filter down the objects given in a list pag ...
随机推荐
- ZOJ 1442 Dinner Is Ready 容斥原理 + java大数
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=442 求解 x1 + x2 + x3 + .... + xn = m 其中xi属 ...
- c++ 对象的内存布局
之前介绍过了普通对象比如系统自带的int等对象的对齐方式,在学习类型转换的时候遇到了自定义类型的继承体系中的downcast与upcast. 于是顺藤摸瓜,摸到了这里.发现还是 陈皓的博客里面写的最早 ...
- 使用js把json字符串转为js对象的方法
ECMA-262(E3) 中没有将JSON概念写到标准中,还好在 ECMA-262(E5)中JSON的概念被正式引入了,包括全局的JSON对象和Date的toJSON方法. 1,eval方式解析,恐怕 ...
- poj 2594 Treasure Exploration (二分匹配)
Treasure Exploration Time Limit: 6000MS Memory Limit: 65536K Total Submissions: 6558 Accepted: 2 ...
- Android停止运行问题1_layout布局xml问题
好好的写了300多行布局文件代码,写完之后运行结果,停止运行了.我当时就奇怪,xml有错误应该会提示啊,我就一个一个的缩小错误的代码范围,先直接换成一个简单的TextView ,运行一下没有错误.再慢 ...
- TCP发消息续传文件
1.自定义固定协议头部.格式:([head][body][filestream]) /// <summary> /// 数据包头部 /// </summary> [Struct ...
- Session过期、失效时间
Session一直是我们做web项目经常使用的,以前没太注意,这次又细致的看了下! 1.session其实就是一个Map,键=值对,通过session.getAttribute("name& ...
- ELK日志管理之——logstash配置语法
Logstash 设计了自己的 DSL -- 有点像 Puppet 的 DSL,或许因为都是用 Ruby 语言写的吧 -- 包括有区域,注释,数据类型(布尔值,字符串,数值,数组,哈希),条件判断,字 ...
- treap树模板
///treap树模板 typedef struct Node ///节点的结构体 { Node *l,*r; int val,pri; ///节点的值和优先级 int sz; ///节点子树的节点数 ...
- 「脑洞」图片转HTML(支持动画)
也许是受到很久以前看到的这玩意儿的原因:The Shapes of CSS 现在开脑洞写了个自动转换,顺便支持了动画……嗯,纯 CSS (:з」∠) 主要步骤就是用 Python 读图片,然后把像素全 ...