Instant Django 1.5 Application Development Starter
- Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
- Model: The application data
- View: which data is presented
- Template: How the data is presented
- A project is just a collection of settings organized in a defined folder structure to run an instance of Django and they can be auto generated using a Django-admin command offered by the Django package.
- The Django development server: python manage.py runserver
- The server runs by default on port 8000 and on the default local host IP 127.0.0.01. you can change this by passing the port as the first argument of the runserver command.
- Each one of the Django apps included by default needs at least one database table that will be created when we run a Django management command called syncdb.
- A Django app is just a Python package with a certain structure located somewhere in your Python path.
- The models essentially represented the database layout with some additional metadata.
- The first thing that you should note is that each model is represented by a class that is a subclass of Django.db.models.Model. the class variables in the models represent the database field.
- Each field is an istance of the Field class and tells Django what kind of data each field holds. Each field type can be easily understood by looking at the class names.
- The name of each field instance is the name that you will use in your Python code to reference the field as well as the column name in your database.
- Syncdb command an be called as many times as you like, it will only create the tables that do not exist in the database.
- In Django, a view is just a Python function that accepts a request object as the first parameter and returns a valid HttpResponse Object.
- When a Django page is requested the engine looks at the ROOT_URLCONF variable in the settings.py file to know which module is responsible for the routing in this module. Django expects to find a variable called urlpatterns, which is a sequence of tuples with following format: (regular expression, Python callback function [, optional directory])
- Django starts matching the requested URL against each regular expression in the list, and as soon as it finds one that matches it calls the callback Python function by passing an HttpRequest object as the first argument.
- HttpRequest.method: A string representing the HTTP method used in the request. This is guaranteed to be uppercase.
- HttpRequest.GET: a dictionary-like object containing all given HTTP GET parameters
- HttpRequest.POST: a dictionary-like object containing all given HTTP POST parameters
- HttpRequest.META: a standard dictionary Python dictionary containing all available HTTP headers.
- HttpRequest.user: A Django.contrib.auth.models.User object representing the currently logged-in user. If the user isn't currently logged in, the user object will be set to an instance of Django.contrib.auth.models.AnonymousUser
- HttpRequest.session: a readable-and-writable dictionary-like object that represents the current session. This is only available if your Django installation has session support activated.
Instant Django 1.5 Application Development Starter的更多相关文章
- Mastering Web Application Development with AngularJS 读书笔记-前记
学习AngularJS的笔记,这个是英文版的,有些地方翻译的很随意,做的笔记不是很详细,用来自勉.觉得写下来要比看能理解的更深入点.有理解不对的地方还请前辈们纠正! 一.关于<Mastering ...
- Oracle Fusion Applications (11.1.8) Media Pack and Oracle Application Development Framework 11g (11.1.1.7.2) for Microsoft Windows x64 (64-bit)
Oracle Fusion Applications (11.1.8) Media Pack for Microsoft Windows x64 (64-bit) 重新搜索 常见问题 提示 ...
- Professional Android Application Development
Professional Android Application Development 访问地址 http://docs.google.com/fileview?id=0ByVHV5sjM4fNNj ...
- WEB Application Development Integrator : 应用设置
1.1. 系统安装 应用 Oracle EBS WEB Application Development Integrator WEB ADI在Oracle EBS 11.5.10.* 版本 ...
- 4: 模块化应用程序开发 Modular Application Development Using Prism Library 5.0 for WPF (英汉对照版)
A modular application is an application that is divided into a set of loosely coupled functional uni ...
- Shiny for Interactive Application Development using R(转)
This slidify-based deck introduces the shiny package from R-Studio and walks one through the develop ...
- Mastering Web Application Development with AngularJS 读书笔记(三)
第一章笔记 (三) 一.Factories factory 方法是创建对象的另一种方式,与service相比更灵活,因为可以注册可任何任意对象创造功能.例如: myMod.factory('notif ...
- Patterns for application development with ASP.NET Core
此文章翻译自 NDC { London } 16-20 January 2017 上, Damian Edwards和David Fowler的演讲,如果翻译不周,请大家指出错误. Logging 生 ...
- Mastering Web Application Development with AngularJS 读书笔记(二)
第一章笔记 (二) 一.scopes的层级和事件系统(the eventing system) 在层级中管理的scopes可以被用做事件总线.AngularJS 允许我们去传播已经命名的事件用一种有效 ...
随机推荐
- python .dcm文件读取,并转化为.jpg格式
.dcm文件是DICOM(Digital Imaging and Communications in Medicine)即医学数字成像和通信中记录医学图像和相关信息的文件,在用于医学图像处理的时候我们 ...
- Java多线程框架Executor详解
原文链接 http://www.imooc.com/article/14377 为什么引入Executor线程池框架new Thread()的缺点 每次new Thread()耗费性能调用ne ...
- java类中serialversionuid 作用 是什么?举个例子说明(转)
serialVersionUID适用于Java的序列化机制.简单来说,Java的序列化机制是通过判断类的serialVersionUID来验证版本一致性的.在进行反序列化时,JVM会把传来的字节流中的 ...
- application配置和profile隔离配置(转)
前言 github: https://github.com/vergilyn/SpringBootDemo 说明:我代码的结构是用profile来区分/激活要加载的配置,从而在一个project中写各 ...
- 如何在ppt或word中添加高亮代码?
如何在ppt或word中添加高亮代码? 问题: 如何ppt中添加带有语法高亮的程序代码,就如同下面的形式(在ppt嵌入高亮代码,且可以编辑,带有行号) 详细的要求如下: 1.代码带有语法高亮. 2.结 ...
- 讲讲python“=”运算符上的优雅语法
心路历程: 之前学linux,虽然学的行算不错,不过总感觉差了点什么,自己找不到也说不出来:直到有一天我看到别人mount上了一个普通文件: 当时给我的感觉这太不可思议了,这个文件又不是块设备:后来脑 ...
- mongodb 远程访问配置
1.首先修改mongodb的配置文件 让其监听所有外网ip 编辑文件:/etc/mongodb.conf 修改后的内容如下: bind_ip = 0.0.0.0 port = 27017 auth=t ...
- 小程序踩过的一个小坑---解析二维码decodeURIComponent() url解码
因为我们需要用户扫码进入小程序,每一个货柜都有一个对应的二维码,当然每个二维码里的信息也不一样.用户扫码进入小程序之后,二维码的信息会以参数q带进去,而我们只能在onLoad事件中拿到这个参数, 但是 ...
- 面试题一:linux面试题
2.4 写出一种排序算法(原理),并说出优化它的方法. 2.5 请简单阐述您最得意的开发之作 2.6 对于大流量的网站,您采用什么样的方法来解决各页面访问量统计问题 a. 确认服务器是否能支撑当前访问 ...
- [CTCI] 最长合成字符串
最长合成字符串 题目描述 有一组单词,请编写一个程序,在数组中找出由数组中字符串组成的最长的串A,即A是由其它单词组成的(可重复)最长的单词. 给定一个string数组str,同时给定数组的大小n.请 ...