没有合适的资源?快使用搜索试试~ 我知道了~
首页Django入门指南:从安装到数据库操作详解
《Django Book》是一本深入介绍Django Web框架的详尽指南,由作者围绕该框架的核心概念、安装过程、动态网页基础、模板系统以及数据建模展开讲解。本书旨在帮助读者掌握Django开发的方方面面。
1. **Django简介**:首先介绍了什么是Web框架,强调了Django作为Python的高级Web开发框架,采用了Model-View-Controller (MVC) 设计模式。书中还提及了Django的历史背景,以及读者如何准备和使用这本书,包括对Python基础知识的要求,以及Django的新特性和获取帮助的方式。
2. **入门阶段**:章节涵盖了Python和Django的安装步骤,包括官方发布版和通过Subversion安装,以及对不同数据库的支持,如PostgreSQL、SQLite3和MySQL。此外,还指导读者如何开始一个Django项目,以及使用开发服务器进行本地开发。
3. **动态网页基础**:这部分介绍了视图的概念,如何将URL映射到视图并处理HTTP请求,以及URL配置的松耦合原则。同时,书中的内容还包括处理404错误、动态URL的创建,以及如何构建美观的错误页面。
4. **模板系统**:深入探讨了模板系统的使用,包括基本知识、模板对象的创建和渲染、上下文的管理,以及模板标签和过滤器的使用。此外,还讲解了如何在视图中应用模板,以及模板加载、locals()技巧和模板继承等高级特性。
5. **数据建模与数据库操作**:针对在视图中处理数据库查询的方法进行了讨论,介绍了 MTV (Model-Template-View) 开发模式,数据库配置和如何创建第一个Django应用程序。这部分内容强调了数据库交互在Django项目中的核心作用。
通过《Django Book》的学习,读者不仅能掌握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页未读,继续阅读
2012-08-13 上传
2017-12-13 上传
2018-03-15 上传
2019-05-31 上传
2010-06-25 上传
144 浏览量
2017-12-17 上传
扁鹊讽齐王纳妾
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功