没有合适的资源?快使用搜索试试~ 我知道了~
首页Django官方教程:PDF版Web框架入门
"django官方教程1.4版PDF格式"
这篇文档是Django官方教程的1.4版本,以PDF格式提供。Django是一个基于Python的Web框架,它遵循Model-Template-View(MTV)的设计模式,用于快速、高效地构建高质量的Web应用。教程覆盖了从安装Django和Python,到创建项目和应用程序,再到与数据库交互以及使用模板系统的全面内容。
1. **Django简介**
- **Web框架**:Django是一个开源的Web框架,用于简化Web应用的开发过程。
- **MVC设计模式**:虽然Django用的是MTV模式,但两者相似,M代表模型(Model),T代表模板(Template),V代表视图(View)。
- **Django历史**:Django由两位新闻开发者创建,旨在解决快速开发的需求。
- **阅读指南**:本教程适合有一定Python基础的读者,并介绍了Django的新特性。
2. **入门**
- **Python安装**:确保系统中安装了Python,这是运行Django的前提。
- **Django安装**:教程详细说明了如何安装官方发布的Django版本,以及如何通过Subversion获取源码安装。
- **数据库安装**:涵盖了PostgreSQL、SQLite3和MySQL的安装,这些是Django支持的数据库系统。
- **开始项目**:介绍如何启动一个新的Django项目,以及使用开发服务器。
3. **动态网页基础**
- **视图**:视图是Django处理请求并返回响应的核心部分,讲解了如何创建第一个视图和动态内容。
- **URL映射**:Django通过URLconf将URL映射到相应的视图函数,实现了松耦合的URL配置。
- **错误处理**:讨论了404错误的处理,以及如何创建美观的错误页面。
4. **Django模板系统**
- **模板系统**:介绍了模板系统的基本概念,如何创建和使用模板,以及如何传递上下文数据。
- **模板标签和过滤器**:详细讲解了模板语言中的标签(如if、for等)和过滤器(用于数据转换)的使用。
- **模板继承**:通过模板继承,可以减少代码重复,保持结构清晰。
5. **数据建模**
- **数据库查询**:演示了在视图中进行数据库操作的不推荐方式,引入了MTV模式的概念。
- **数据库配置**:说明了如何在Django项目中配置数据库,以支持不同的数据库系统。
- **创建应用程序**:教程指导读者创建第一个Django应用程序,并进行了初步的数据库模型设计。
这个教程不仅适合初学者,也对有一定经验的Django开发者有参考价值,涵盖了从基础到进阶的多个方面,是学习和理解Django框架的宝贵资源。
The Django Book
16 http://djangobook.py3k.cn/
get_FOO_filename() ..........................................................................................................................401
get_FOO_url() ...................................................................................................................................401
get_FOO_size() ..................................................................................................................................402
save_FOO_file(filename, raw_contents) ............................................................................................402
get_FOO_height() and get_FOO_width() ...........................................................................................402
捷径 .....................................................................................................................................................402
get_object_or_404() .........................................................................................................................402
get_list_or_404() ...............................................................................................................................403
回归原始的 SQL 操作 ..........................................................................................................................403
附录 D 通用视图参考 .............................................................................................................................405
通用视图的常见参数 ...........................................................................................................................405
简易通用视图 ......................................................................................................................................405
渲染模板 ..........................................................................................................................................406
重定向到另外一个 URL ....................................................................................................................406
列表/详细 通用视图 ...........................................................................................................................407
对象列表 ..........................................................................................................................................407
Detail Views ......................................................................................................................................409
基于日期的通用视图 ...........................................................................................................................412
存档索引 ..........................................................................................................................................412
Year Archives ....................................................................................................................................414
Month Archives .................................................................................................................................415
Week Archives ..................................................................................................................................417
Day Archives .....................................................................................................................................419
Archive for Today ..............................................................................................................................420
Date-Based Detail Pages ....................................................................................................................421
Create/Update/Delete Generic Views ...................................................................................................423
Create Object View ...........................................................................................................................424
Update Object View ..........................................................................................................................425
Delete Object View ...........................................................................................................................427
附录 E 配置参考 .....................................................................................................................................429
The Django Book
17 http://djangobook.py3k.cn/
什么是 settings 文件 ............................................................................................................................429
默认 Settings ....................................................................................................................................429
查看你已经改变了哪些 Settings ......................................................................................................430
在 Python 代码中使 Settings ............................................................................................................430
运行期间修改 Settings .....................................................................................................................430
指派 Settings: DJANGO_SETTINGS_MODULE ........................................................................................431
django-admin.py 工具......................................................................................................................431
服务器端(mod_python) ....................................................................................................................432
不设置 DJANGO_SETTINGS_MODULE 而使用 Settings .........................................................................432
定制默认的 Settings .........................................................................................................................433
configure()或 DJANGO_SETTINGS_MODULE 之一是必须的 ..............................................................433
合法的 Settings ....................................................................................................................................434
ABSOLUTE_URL_OVERRIDES .............................................................................................................434
ADMIN_FOR ......................................................................................................................................434
ADMIN_MEDIA_PREFIX .....................................................................................................................434
ADMINS ............................................................................................................................................434
ALLOWED_INCLUDE_ROOTS .............................................................................................................435
APPEND_SLASH .................................................................................................................................435
CACHE_BACKEND ..............................................................................................................................435
CACHE_MIDDLEWARE_KEY_PREFIX ...................................................................................................435
DATABASE_ENGINE ...........................................................................................................................435
DATABASE_HOST ..............................................................................................................................436
DATABASE_NAME .............................................................................................................................436
DATABASE_OPTIONS .........................................................................................................................436
DATABASE_PASSWORD .....................................................................................................................436
DATABASE_PORT ..............................................................................................................................436
DATABASE_USER ...............................................................................................................................437
DATE_FORMAT .................................................................................................................................437
DATETIME_FORMAT .........................................................................................................................437
DEBUG ..............................................................................................................................................437
The Django Book
18 http://djangobook.py3k.cn/
DEFAULT_CHARSET ...........................................................................................................................438
DEFAULT_CONTENT_TYPE .................................................................................................................438
DEFAULT_FROM_EMAIL ....................................................................................................................438
DISALLOWED_USER_AGENTS ............................................................................................................438
EMAIL_HOST .....................................................................................................................................438
EMAIL_HOST_PASSWORD .................................................................................................................439
EMAIL_HOST_USER ...........................................................................................................................439
EMAIL_PORT .....................................................................................................................................439
EMAIL_SUBJECT_PREFIX ....................................................................................................................439
FIXTURE_DIRS ...................................................................................................................................439
IGNORABLE_404_ENDS .....................................................................................................................440
IGNORABLE_404_STARTS ..................................................................................................................440
INSTALLED_APPS ...............................................................................................................................440
INTERNAL_IPS ...................................................................................................................................440
JING_PATH ........................................................................................................................................440
LANGUAGE_CODE .............................................................................................................................441
LANGUAGES ......................................................................................................................................441
MANAGERS .......................................................................................................................................441
MEDIA_ROOT ....................................................................................................................................442
MEDIA_URL .......................................................................................................................................442
MIDDLEWARE_CLASSES ....................................................................................................................442
MONTH_DAY_FORMAT .....................................................................................................................442
PREPEND_WWW ...............................................................................................................................443
PROFANITIES_LIST .............................................................................................................................443
ROOT_URLCONF................................................................................................................................443
SECRET_KEY ......................................................................................................................................443
SEND_BROKEN_LINK_EMAILS............................................................................................................443
SERIALIZATION_MODULES ................................................................................................................444
SERVER_EMAIL ..................................................................................................................................444
SESSION_COOKIE_AGE ......................................................................................................................444
The Django Book
19 http://djangobook.py3k.cn/
SESSION_COOKIE_DOMAIN ...............................................................................................................444
SESSION_COOKIE_NAME ...................................................................................................................444
SESSION_COOKIE_SECURE ................................................................................................................445
SESSION_EXPIRE_AT_BROWSER_CLOSE ............................................................................................445
SESSION_SAVE_EVERY_REQUEST ......................................................................................................445
SITE_ID ..............................................................................................................................................445
TEMPLATE_CONTEXT_PROCESSORS ..................................................................................................445
TEMPLATE_DEBUG ............................................................................................................................446
TEMPLATE_DIRS ................................................................................................................................446
TEMPLATE_LOADERS.........................................................................................................................446
TEMPLATE_STRING_IF_INVALID ........................................................................................................446
TEST_RUNNER ...................................................................................................................................446
TEST_DATABASE_NAME ....................................................................................................................447
TIME_FORMAT ..................................................................................................................................447
TIME_ZONE .......................................................................................................................................447
URL_VALIDATOR_USER_AGENT.........................................................................................................448
USE_ETAGS .......................................................................................................................................448
USE_I18N ..........................................................................................................................................448
YEAR_MONTH_FORMAT ...................................................................................................................448
附录 F 内建的模板标签和过滤器 ...........................................................................................................450
内建标签参考 ......................................................................................................................................450
block .................................................................................................................................................450
comment ..........................................................................................................................................450
cycle..................................................................................................................................................450
debug................................................................................................................................................451
extends .............................................................................................................................................451
filter ..................................................................................................................................................451
firstof ................................................................................................................................................451
for .....................................................................................................................................................452
if .......................................................................................................................................................452
The Django Book
20 http://djangobook.py3k.cn/
ifchanged ..........................................................................................................................................454
ifequal ...............................................................................................................................................454
ifnotequal .........................................................................................................................................455
include ..............................................................................................................................................455
load...................................................................................................................................................455
now...................................................................................................................................................455
regroup .............................................................................................................................................457
spaceless ...........................................................................................................................................458
ssi .....................................................................................................................................................459
templatetag ......................................................................................................................................459
url .....................................................................................................................................................460
Built-in Filter Reference ........................................................................................................................460
add ...................................................................................................................................................460
addslashes ........................................................................................................................................461
capfirst ..............................................................................................................................................461
center ...............................................................................................................................................461
cut ....................................................................................................................................................461
date ..................................................................................................................................................461
default ..............................................................................................................................................462
default_if_none ................................................................................................................................462
dictsort .............................................................................................................................................462
dictsortreversed ................................................................................................................................462
divisibleby .........................................................................................................................................462
escape...............................................................................................................................................463
filesizeformat ....................................................................................................................................463
first ...................................................................................................................................................463
fix_ampersands .................................................................................................................................464
floatformat .......................................................................................................................................464
get_digit............................................................................................................................................464
join....................................................................................................................................................465
剩余495页未读,继续阅读
kaixings
- 粉丝: 2
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Credits-App:积分叠加
- meetup_map_oauth2:使用 OAuth2 通过 Meetup API 获取事件
- 行业分类-设备装置-同时向主叫用户和被叫用户播放多媒体信息的方法.zip
- react todo list and counter:精益应对构建Webapp待办事项列表和计数器应用程序-开源
- 数据库管理
- Manual-Gating
- 行业分类-设备装置-可翻转式台板和用于PCBA测试的机器人上下料系统.zip
- BeatDetectorForGames:用于视频游戏的 C++ 和 C# 节拍检测器。 可以接收歌曲并检测节拍发生的位置,例如在 Vib-Ribbon 等游戏中
- 医学图像分割经典深度学习网络Python代码实现.zip
- MLEM:MLEM库,用于扩展MonoGame
- terraform-aks-devops:使用AzureDevOps设置AKS群集的示例存储库
- 行业分类-设备装置-台式陶瓷三维喷印成形机.zip
- Catwalk:一种使客户能够搜索,浏览,添加到购物车和结帐项目的产品
- FastFileTransfer
- gulp-setup:gulp 的入门项目
- 行业分类-设备装置-可见光无源光充电标签与读写器装置.zip
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功