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 允许我们去传播已经命名的事件用一种有效 ...
随机推荐
- Android中ViewPager实现滑动条及与Fragment结合的实例教程
ViewPager类主要被用来实现可滑动的视图功能,这里我们就来共同学习Android中ViewPager实现滑动条及与Fragment结合的实例教程,需要的朋友可以参考下 自主实现滑动指示条先上一个 ...
- Java之基于S2SH与手机数据交互(一)
在前两篇博客,介绍了在eclipse上搭建SSH,可是好多小伙伴反映.看了偶写滴博客.跟着搭建还是错误百出,唉! 事实上不经历错误怎么能不见红线啊!于是我在上篇博客补充了他们的错误,还在被错误困扰的童 ...
- winform中键盘和鼠标事件的捕捉和重写
在编写winform应用程序时,有时需要无论在哪个控件获取焦点时,对某一个键盘输入或者鼠标事件都进行同样的操作.比如编写一个处理图片的应用程序时,希望无论当前哪个控件获得焦点,当用户按上.下.左.右键 ...
- 【OpenCV】给图像加入噪声
图像噪声使图像在获取或是传输过程中收到随机信号干扰,妨碍人们对图像理解及分析处理的信号.非常多时候将图像噪声看做多维随机过程,因而描写叙述噪声的方法全然能够借用随机过程的描写叙述,也就是使用随机过程的 ...
- dd-wrt 中继配置
本配置方法在tp-link 703n v1.6上应用成功 1.首先把703n刷成dd-wrt.这里我刷的是 DD-WRT v24-sp2 (03/15/12) std版本,要刷两个固件,一个facto ...
- 参数化查询 '(@ActualShipTime datetime' 需要参数 @AuthorizationNumber,但未提供该参数。
转自 http://www.cnblogs.com/cxd4321/archive/2012/08/09/2629716.html 在平时的C#项目开发中,当调用某个存储过程或函数的时候,我们可能经常 ...
- ansible 学习记录
Ansible 的重新学习记录 这里我的Ansible的宿主机是centos 7.2系统,这里我通过yum 安装Ansible 1.配置epel源 sudo yum -y install epel-r ...
- Mac 配置 Jenkins
关于 Jenkins Jenkins 是一个开源软件项目,旨在提供一个开放易用的软件平台,使持续集成变成可能. 安装 Jenkins 并配置, http://linjunpop.logdown.com ...
- 给Java开发人员的Play Framework(2.4)介绍 Part1:Play的优缺点以及适用场景
1. 关于这篇系列 这篇系列不是Play框架的Hello World,由于这样的文章网上已经有非常多. 这篇系列会首先结合实际代码介绍Play的特点以及适用场景.然后会有几篇文章介绍Play与Spri ...
- Atitit 面试问题总结
Atitit 面试问题总结 1. 面试约人阶段可以预先1俩分钟大概问下情况1 2. 自我介绍阶段1 3. 技术方面2 3.1. 界面方面2 3.2. Java 本身 了解spring mybati ...