没有合适的资源?快使用搜索试试~ 我知道了~
首页Django入门指南:从安装到数据库建模
"《The Django Book》是一本关于Django Web框架的中文教程,适合初学者和有一定Python基础的开发者。书中介绍了Django的历史、如何阅读本书、所需的编程知识,以及如何安装和使用Django。内容包括入门指南、动态网页基础、Django模板系统和与数据库交互等核心概念。"
在《Django Book》中,作者首先讲解了Django的基本概念,如Web框架的定义,MVC(模型-视图-控制器)设计模式,以及Django的起源。对于打算学习这本书的读者,建议具备一定的Python基础,并了解Django的新特性。书中提供了获取帮助的途径,便于读者在学习过程中解决疑惑。
第二章引导读者进行Django的安装,包括Python环境的准备和Django的官方发布版安装,还介绍了通过Subversion源码方式安装。同时,书中详细阐述了如何配置和选择不同的数据库系统,如PostgreSQL、SQLite3和MySQL,以及如何在无数据库支持的情况下使用Django。此外,开始一个项目并启动开发服务器是这一章节的重点,帮助读者快速进入实际操作阶段。
第三章深入探讨了动态网页的基础,如视图(views)的概念,如何将URL映射到视图,以及Django处理请求的流程。通过示例,读者可以理解如何实现动态内容和动态URL,同时学习了URL配置的松耦合特性,处理404错误,以及优化URL设计的方法。
第四章介绍了Django的模板系统,这是构建动态网页的关键部分。读者将学习模板的基本结构,如何创建和渲染模板,以及如何处理多个上下文。书中还涵盖了模板标签和过滤器的使用,以及模板继承等高级特性,帮助开发者更好地组织和重用模板代码。
第五章聚焦于Django的数据建模,即如何与数据库进行交互。书中展示了避免直接在视图中进行数据库查询的笨方法,引入了Model-Template-View(MTV)开发模式,并详细解释了数据库配置。通过创建第一个应用程序,读者将学习如何定义模型,进行数据库操作,以及执行基本的查询。
《The Django Book》是一本全面介绍Django的中文教材,涵盖了从安装到实际开发的各个环节,对想要掌握Django的开发者来说是宝贵的资源。通过学习,读者可以逐步掌握构建高效、优雅的Web应用的技能。
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页未读,继续阅读
2018-03-08 上传
2017-12-17 上传
2017-11-14 上传
2019-07-26 上传
2022-03-10 上传
hllyzms
- 粉丝: 6066
- 资源: 135
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- PortafolioAdsi:工业生物技术中心 ADSI 案例研究项目 - Palmira。 软件开发的整个过程将展示实施 Scrum 框架,以同样的方式利用 JAVA、JPA、Mysql、Html5、CSS 等技术
- ISO15118是欧洲的电动汽车充电协议标准,这是第一部分,通用信息及用例定义
- 测试
- teamtool-spring:团队工具(Spring MVC)
- Learners-Academy
- 为桌面和Web应用程序配置Log4Net
- be-kanBAO:后端做看报
- react-redux-flask-mongodb:带有Mongodb的Flask JWT后端和带有Material UI的ReactRedux前端的入门应用程序
- 新的多站点DLL或如何在根目录中开发.NET项目
- fakhrusy.com:我的个人网站
- image-mosaic
- pyg_lib-0.3.0+pt20-cp310-cp310-macosx_11_0_x86_64whl.zip
- N10SG开发教学视频.zip
- Toolint-tests-Empty-TC-Add-Tools-2021-04-07T15-40-16.889Z:为工具链创建
- 122页中国移动互联网2019半年大报告-QuestMobile-2019.7.rar
- practice:练习
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功