-
Notifications
You must be signed in to change notification settings - Fork 20
/
django.html
355 lines (354 loc) · 40.6 KB
/
django.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Matt Makai">
<meta name="description" content="在 Full Stack Python 上学习更多 Django 知识, Django 是一个流行的且功能完备的 Python Web 框架。">
<title>Django - Full Stack Python</title>
<link href="/f.css" rel="stylesheet">
<link rel="shortcut icon" href="/img/fsp-fav.png">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="logo-header-section">
<a href="/" style="text-decoration: none; border: none;"><img src="/img/logo-sm.png" class="logo-image" alt="Full Stack Python logo"></a>
<span class="logo-title"><a href="https://www.fullstackpython.com/">Full Stack Python</a></span>
</div>
<div class="sans-font">
<!--<a href="/blog.html" class="submenu-item-first">Blog</a> |
<a href="/books.html" class="submenu-item">Books</a> | -->
<a href="/table-of-contents.html">全部主题</a>
<span style="margin:0 12px 0 12px">|</span>
<a href="/blog.html">Blog</a>
<span style="margin:0 12px 0 12px">|</span>
<a href="/email.html">时讯</a>
<span style="margin:0 12px 0 12px">|</span>
<a href="https://twitter.com/fullstackpython">@fullstackpython</a>
<span style="margin:0 12px 0 12px">|</span>
<a href="https://www.facebook.com/fullstackpython">Facebook</a>
<span style="margin:0 12px 0 12px">|</span>
<a href="https://github.com/mattmakai/fullstackpython.com">源码</a>
</div> </div>
</div><div class="row">
<div class="col-md-8">
<h1>Django</h1>
<p><a href="http://www.djangoproject.com/">Django</a> 是一个广为使用的 Python Web 应用框架,它奉行 “包含一切” 的哲学。该理念即为:创建 Web 应用所需的通用功能都应该包含到框架中,而不应存在于独立的软件包中。 </p>
<p><a href="http://www.djangoproject.com/" style="border: none;"><img src="/img/django-logo-positive.png" width="100%" alt="Official Django logo. Trademark Django Software Foundation." class="technical-diagram" /></a></p>
<p>例如,<a href="https://docs.djangoproject.com/en/dev/topics/auth/">身份验证</a>、 <a href="https://docs.djangoproject.com/en/dev/topics/http/urls/">URL 路由</a>、 <a href="https://docs.djangoproject.com/en/dev/topics/templates/">模板系统</a>、 <a href="/object-relational-mappers-orms.html">对象关系映射</a> (ORM) 和 <a href="https://docs.djangoproject.com/en/dev/topics/migrations/">数据库迁移</a> (版本 1.7) 等功能都已包含在 <a href="https://pypi.python.org/pypi/Django/">Django 框架</a> 中。 Flask 框架与 Django 相比,并没有包含这么多的功能,例如它还需要一个独立的 <a href="https://flask-login.readthedocs.org/en/latest/">Flask-Login</a> 库来实现用户身份验证。</p>
<p>包含一切和易扩展性是实现框架时采用的两种不同哲学罢了,再两种方式各有千秋,不能说哪一种会再好。</p>
<div class="well see-also">Django 是对<a href="/web-frameworks.html">Web 框架</a> 概念的一种实现。在 <a href="/web-development.html">Web 开发</a> 那一章你可以框架的各部分组件是如何协同工作的,或者到 <a href="/table-of-contents.html">总目录</a> 页去查看其它所有主题。</div>
<h2>为什么说 Django Web 框架是一个不错的选择</h2>
<p>自创建以来, Django 项目的稳定性、高性能和它的社区在过去的十年中有了长足的发展。现在已经有大量的在线资源和图书资料,从中你能找到详细的教程和实践指南。该框架还在不断地往新版本中增加诸如 <a href="https://docs.djangoproject.com/en/dev/topics/migrations/">数据迁移</a> 新功能。</p>
<p>我非常推荐 Python Web 开发新手使用 Django 框架,因为它的官方文档和一些教程的质量在软件开发界都是数一数二的。许多城市都有 Django 团体,如 <a href="http://www.meetup.com/django-district/">Django District</a>、 <a href="http://www.meetup.com/djangoboston/">Django Boston</a> 和 <a href="http://www.meetup.com/The-San-Francisco-Django-Meetup-Group/">San Francisco Django</a>,因此新手在碰到难题时能获得帮助。</p>
<p>虽然有 <a href="http://www.jeffknupp.com/blog/2012/12/11/learning-python-via-django-considered-harmful/">通过使用 Django 来学习 Python 是不好的</a> 这样的争议。但是,对于先前已经花时间学过 Python 语法和语义,然后才转入 Web 开发的人来说,这样的说法是站不住脚的。</p>
<h2>Django 图书和教程</h2>
<p>已经有大量的免费或低价的 Django 资源。不过 Django 是在 10 年前发布的,并且之后又进行了大量的更新,因此当你要找一本与时俱进的 Django 图书时,应该先看看下面的这份列表,或者读下这篇文章 <a href="http://twoscoopspress.org/pages/current-django-books">当前的 Django 图书</a>,截止到 Django 1.8,1.9。</p>
<ul>
<li>
<p><a href="http://www.obeythetestinggoat.com/">Python 测试驱动开发</a> 着重讲解如何用 Django 和 JavaScript 进行 Web 开发。该书将 Django 作为网站开发框架,并以一个实际案例的开发为例,讲解了如何进行测试驱动开发(TDD)。它的内容还涉及到 NoSQL、 Websocket 和异步响应等。该书能在网上免费阅读,或者你也可以购买 O'Reilly 的纸质版本。</p>
</li>
<li>
<p><a href="http://www.tangowithdjango.com/book17/">和 Django 跳探戈</a> 上有一系列内容丰富的免费文章,介绍如何使用这个最受欢迎的 Python Web 框架。 现在很多开发人员都说这份资料对于他们克服刚开始学习框架时的困难很有帮助。这份资料最近已更新到 Django 1.7!</p>
</li>
<li>
<p><a href="http://tutorial.djangogirls.org/en/index.html">Django 宅女教程</a> 是一份不错的教程,它能帮助你创建你的首个 Web 应用,并且不要求你之前有任何 Python 或 Django 相关知识。</p>
</li>
<li>
<p>由 Daniel Greenfeld 和 Audrey Roy 写的 <a href="http://twoscoopspress.com/products/two-scoops-of-django-1-8">2 Scoops of Django</a> 对于真正想学好如何正确开发 Django 网站的人来说物有所值。</p>
</li>
<li>
<p>这篇教程展示了如何创建 <a href="https://www.twilio.com/docs/tutorials/walkthrough/automated-survey/python/django">一个 Django Web 应用,它能通过打电话和发短信实现自动调查</a>。
它的代码是一个非常不错的完整 Django 项目示例,并且已在 <a href="https://github.com/TwilioDevEd/automated-survey-django">GitHub 上开源了</a>。</p>
</li>
<li>
<p><a href="http://effectivedjango.com/">高效 Django</a> 是另一份介绍 Web 框架的免费资料。</p>
</li>
<li>
<p><a href="http://www.reddit.com/r/django">Django subreddit</a> 上经常会有与 Django 学习相关的最新链接,并且那里也是个提 Django 问题的好地方。</p>
</li>
<li>
<p>Steve Losh 写了一篇详实精彩的文章 <a href="http://stevelosh.com/blog/2011/06/django-advice/">Django 忠告指南</a>。</p>
</li>
<li>
<p><a href="http://programming.oreilly.com/2014/04/simplifying-django.html">轻量化 Django</a> 上有一些不错的示例,详述如何将 Django 分解成一些更小的组件。</p>
</li>
<li>
<p><a href="https://github.com/rogueleaderr/definitive_guide_to_django_deployment">Django 部署权威指南</a> 对配置后的结构进行讲解,并包含一个自动化部署的 Chef 脚本。</p>
</li>
<li>
<p><a href="http://aliteralmind.wordpress.com/2014/09/21/jquery_django_tutorial/">Django 分步指南</a> 展示了如何在 JQuery 中通过 AJAX 传输数据。</p>
</li>
<li>
<p><a href="https://github.com/rosarior/awesome-django">django-awesome</a> 是一份精心整理的 Django 库和资源的列表。</p>
</li>
<li>
<p><a href="https://realpython.com/learn/start-django/">开始一个 Django 项目</a> 解答了这个问题:“我如何从零开始配置一个 Django (1.5, 1.6, 1.7, or 1.8) 项目?”。</p>
</li>
<li>
<p>这份 Django 教程讲解了 <a href="http://drksephy.github.io/2015/07/16/django/">如何使用 Twitter Bootstrap、 Bower、 Requests 和 Github API 从零开始创建一个项目</a>。</p>
</li>
<li>
<p><a href="http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/">推荐的 Django 项目布局</a> 能帮助 Django 开发新手理解项目中每个App的目录和文件是如何组织的。</p>
</li>
<li>
<p><a href="https://github.com/davisfreeman1015/SocialAuthDjangoTutorial">Django 整合 Python 社交认证教程</a> 向你展示了如何在你的 Django 应用中集成社交媒体登录按钮。</p>
</li>
<li>
<p>由 Luke Plant 所写的 <a href="http://lukeplant.me.uk/blog/posts/my-approach-to-class-based-views/">他自己的基于类的视图的另一种方法</a> (CBVs)这篇文章,经常会在 Django 社区中激起关于 CBV 是否能节省时间或者对于框架来说它是否”太过神奇“等的热烈争论。</p>
</li>
<li>
<p><a href="https://www.digitalocean.com/community/tutorials/how-to-serve-django-applications-with-uwsgi-and-nginx-on-ubuntu-14-04">如何在 Ubuntu 14.04 上使用 uWSGI 和 Nginx 部署 Django 应用</a> 及 <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-centos-7">如何设置 Django 、 PostgreSQL、 Nginx 和 Gunicorn</a> 这两个教程,详细演示了部署过程中的每个步骤。</p>
</li>
<li>
<p>每个 Web 应用都应处理好时区问题。这篇 <a href="http://tommikaikkonen.github.io/timezones/">发布在 pytz and Django 上的文章</a> 对于你需要为此了解哪些知识给你指明了方向。</p>
</li>
</ul>
<h2>Django 视频资源</h2>
<p>除了文章,你还想找 Django 视频吗?在 <a href="/best-python-videos.html">最佳 Python 视频</a> 页上有一节专门针对 Django 和 Web 开发的。</p>
<h2>Django 迁移</h2>
<ul>
<li>
<p>Paul Hallett 发布在 Twilio 博客上的文章 <a href="https://www.twilio.com/blog/2014/10/upgrading-your-django-reusable-app-to-support-django-1-7.html">Django 1.7 应用升级详细指南</a> 讲述了他对 django-twilio 包的使用经验。</p>
</li>
<li>
<p>Real Python 上的 <a href="https://realpython.com/blog/python/django-migrations-a-primer/">迁移入门教程</a> 探讨了 South 与 Django 内置的迁移功能之间的区别,并介绍了它们的使用方法。</p>
</li>
<li>
<p>Andrew Pinkham 写的 ”升级到 Django 1.7“ 系列文章是很好的学习材料,据此你能了解该版本主要进行了哪些更新,以及能学到应如何相应地对你的 Django 项目进行更新。 <a href="http://andrewsforge.com/article/upgrading-django-to-17/part-1-introduction-and-django-releases/">第 1 部分</a>、 <a href="http://andrewsforge.com/article/upgrading-django-to-17/part-2-migrations-in-django-16-and-17/">第 2 部分</a>、 <a href="http://andrewsforge.com/article/upgrading-django-to-17/part-3-django-17-new-features/">第 3 部分</a> 和 <a href="http://andrewsforge.com/article/upgrading-django-to-17/part-4-upgrade-strategies/">第 4 部分</a> 现在都能找到。</p>
</li>
<li>
<p><a href="http://pankrat.github.io/2015/django-migrations-without-downtimes/">不下线迁移 Django </a> 展示了如何在 Django 站点不下线的情况下进行数据迁移。</p>
</li>
</ul>
<h2>1.9+ 中的通道</h2>
<p>通道是 Django 1.9 的一种新机制(作为一个独立应用,稍后会合并到核心框架中),它能基于 <a href="/websockets.html">WebSocket</a> 实现浏览器与服务器之间的实时双向通讯。</p>
<ul>
<li>
<p><a href="https://blog.heroku.com/archives/2016/3/17/in_deep_with_django_channels_the_future_of_real_time_apps_in_django">这份教程展示了如何在你的项目中引入 Django 通道功能</a>。</p>
</li>
<li>
<p><a href="https://github.com/andrewgodwin/channels-examples">这个通道示例代码库</a> 里有一些不错的初始项目,如实时博客和聊天应用等,可以用作你的基础代码。</p>
</li>
<li>
<p>通道目前使用 Django 现有的认证机制,但是这篇文章 <a href="http://www.machinalis.com/blog/jwt-django-channels/">在 Django 通道中使用 JSON Web Tokens 认证</a> 展示了如何在 Django 通道中使用第三方的 <a href="https://jwt.io/">JSON Web Token (JWT)</a> 进行实现。</p>
</li>
</ul>
<h2>Django 测试</h2>
<ul>
<li>
<p><a href="https://lincolnloop.com/blog/integrating-front-end-tools-your-django-project/">Django 集成前端工具</a> 这篇文章指出了如何在开发环境或生产环境的 Django 网站上使用 <a href="http://gulpjs.com/">Gulp</a> 来处理前端工具。</p>
</li>
<li>
<p><a href="http://howchoo.com/g/mjkwmtu5zdl/getting-started-with-django-testing">开始 Django 测试</a> 将使你不再耽搁你的 Django 项目测试计划,如何你之前不知从何开始测试的话。</p>
</li>
<li>
<p><a href="https://realpython.com/blog/python/testing-in-django-part-1-best-practices-and-examples/">Django 测试</a> 提供了大量的示例,并据此讲解如何对你的 Django 项目代码进行测试。</p>
</li>
<li>
<p><a href="https://medium.com/@unary/django-views-automated-testing-with-selenium-d9df95bdc926">使用 Selenium 对 Django 视图进行自动化测试</a> 使用了一些示例代码来演示如何在浏览器里使用 <a href="http://www.seleniumhq.org">Selenium</a> 进行测试。</p>
</li>
</ul>
<h2>Django 及 Angular (Djangular) 资源</h2>
<ul>
<li>
<p><a href="http://blog.kevinastone.com/getting-started-with-django-rest-framework-and-angularjs.html">Django Rest 框架与 AngularJS 入门</a> 是一篇有关 Djangular 的详细介绍,并附带示例代码。</p>
</li>
<li>
<p><a href="https://thinkster.io/brewer/angular-django-tutorial/">用 Django 和 AngularJS 创建 Web 应用</a> 是一篇非常详实的指南,讲述如何以 Django 作为 API 层以及将 AngularJS 作为浏览器 MVC 前端进行开发。</p>
</li>
<li>
<p>这篇教程 <a href="http://mourafiq.com/2013/07/01/end-to-end-web-app-with-django-angular-1.html">用 Django-Rest 框架 & AngularJS 进行 Web 应用开发,第 1 部分</a> 以及其 <a href="http://mourafiq.com/2013/07/15/end-to-end-web-app-with-django-angular-2.html">第 2 部分</a>、 <a href="http://mourafiq.com/2013/08/01/end-to-end-web-app-with-django-angular-3.html">第 3 部分</a> 和 <a href="http://mourafiq.com/2013/08/15/end-to-end-web-app-with-django-angular-4.html">第 4 部分</a> 讲述了如何用 Djangular 创建一个示例博客系统。该项目的代码存放在 <a href="https://github.com/mouradmourafiq/django-angular-blog">GitHub 上</a>。</p>
</li>
<li>
<p><a href="https://github.com/jrief/django-angular">Django-angular</a> 这个代码库意在使 Django 和 AngularJS 在前端开发上更匹配。</p>
</li>
</ul>
<h2>Django ORM 资源</h2>
<p>Django 有自己内置的的对象关系映射器(ORM), 通常指代为 "the Django ORM"。到 <a href="/object-relational-mappers-orms.html">Python 对象关系映射页</a> 上了解 Django ORM 相关的更多信息,那上面有一节是专门解读 Django ORM的,当然上面还有其它的资源和教程。</p>
<h2>静态和媒体文件</h2>
<p>Django 初级开发人员对于如何部署和处理静态和媒体文件会感觉困惑。下面列出的资料以及 <a href="/static-content.html">静态内容</a> 那一页上的资源对于搞清楚如何正确处理这些文件很有帮助。</p>
<ul>
<li>
<p><a href="http://www.caktusgroup.com/blog/2014/11/10/Using-Amazon-S3-to-store-your-Django-sites-static-and-media-files/">使用 Amazon S3 来存储你的 Django 站点静态和媒体文件</a> 是一篇很好的文章,解答了如何部署静态和媒体文件这个通常被问到的问题。</p>
</li>
<li>
<p><a href="http://www.revsys.com/blog/2014/dec/03/loading-django-files-from-code/">从文件系统中导入 Django FileField 和 ImageFields</a> 向你展示了数据模型的文件类型的项值是如何从文件系统中导入的。</p>
</li>
<li>
<p><a href="http://blog.wearefarm.com/2015/02/09/contact-form-uploads/">在 Django 中限制对用户上传的文件的访问</a> 提供了对媒体文件的一种保护机制。</p>
</li>
</ul>
<h2>开源 Django 示例项目</h2>
<ul>
<li>
<p><a href="https://www.twilio.com/docs/howto/walkthrough/browser-calls/python/django">使用 Django 和 Twilio 制作浏览器通话器</a> 展示了如何利用 Django 和 <a href="https://www.twilio.com/client">Twilio 客户端</a> 来创建一个 Web 应用,将用户的浏览器改造成一个全功能的电话机。非常有趣。</p>
</li>
<li>
<p><a href="https://github.com/mattmakai/txt2react">Txt 2 React</a> 是一个 Django Web 应用,它能让观众一边观看演示,一边输入反馈信息或者提问。</p>
</li>
<li>
<p><a href="https://github.com/ustream/openduty">Openduty</a> 是一个网站状态检查和报警系统,类似于 PagerDuty。</p>
</li>
<li>
<p><a href="https://github.com/myusuf3/courtside">Courtside</a> 是一个收集体育活动信息的 Web 应用,由 PyCoder‘s Weekly 的作者编写和维护。</p>
</li>
<li>
<p>Django 交互式语音应答系统 (IVR),它的两份 Web 应用代码库: <a href="https://github.com/phalt/twilio-django-part-1">第 1 部分</a> 和 <a href="https://github.com/phalt/twilio-django-part-2">第 2 部分</a> 向你展示了如何创建一个真正有趣的 Django 应用 。它还有相应的 <a href="https://www.twilio.com/blog/2014/07/build-an-ivr-system-with-twilio-and-django.html">文章</a>, 对其中的每一个步骤进行了详细的讲解。</p>
</li>
<li>
<p><a href="https://github.com/taigaio/taiga-back">Taiga</a> 是一个项目管理工具,后端用 Django 开发,前端用 AngularJS 开发。</p>
</li>
</ul>
<h2>Django 项目模板</h2>
<ul>
<li>
<p><a href="https://github.com/caktus/django-project-template">Caktus Group Django 项目模板</a> 适用于 Django 1.6+。</p>
</li>
<li>
<p><a href="https://github.com/pydanny/cookiecutter-django">Cookiecutter Django</a> 这个项目模板出自 Daniel Greenfeld,它使用了 Audrey Roy 的 <a href="https://github.com/audreyr/cookiecutter">Cookiecutter</a>。使用该模板的项目部署到 Heroku 上非常容易。</p>
</li>
<li>
<p><a href="https://github.com/twoscoops/django-twoscoops-project">Two Scoops Django 项目模板</a> 同样来自 PyDanny 和 Audrey Roy。这个模板提供了一个在《Two Scoops of Django》那本书中描述过的快速代码框架。</p>
</li>
<li>
<p><a href="https://github.com/mozilla/sugardough">Sugardough</a> 这个 Django 项目模板来自 Mozilla,并与 cookiecutter 兼容。</p>
</li>
</ul>
<h2>Django 学习清单</h2>
<ol>
<li>
<p>在你的本地开发机器上 <a href="https://docs.djangoproject.com/en/dev/topics/install/">安装 Django</a>。</p>
</li>
<li>
<p>依据 <a href="https://docs.djangoproject.com/en/dev/intro/tutorial01/">"polls" 这个教程</a>进行练习。</p>
</li>
<li>
<p>依据 “Django 资源” 那一节上的相关教程,创建一些简单的应用。</p>
</li>
<li>
<p>参考 <a href="https://docs.djangoproject.com/en/dev/">官方文档</a> 以及上面的资源链接,开始编写你自己的 Django 项目。当然你会犯错误,但这是你学习如何正确的创建应用的必经之路。</p>
</li>
<li>
<p>阅读 <a href="http://www.amazon.com/Two-Scoops-Django-Best-Practices/dp/0981467342">2 Scoops of Django</a> 来理解 Django 的最佳实践,并学会什么是创建 Django Web 应用的更好方式。</p>
</li>
<li>
<p>查看 <a href="/deployment.html">部署那一章</a>,将你的 Django 项目发布到网上。</p>
</li>
</ol>
<h3>关于 Django 应用,接下来还要学习什么知识?</h3>
<div class="row">
<div class="col-md-4">
<div class="well select-next">
<a href="/cascading-style-sheets.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M275 128h1505l-266 1333-804 267-698-267 71-356h297l-29 147 422 161 486-161 68-339h-1208l58-297h1209l38-191h-1208z" fill="#fff"/></svg></a>
<p class="under-btn">我的应用可以运行但是很难看。如何美化用户界面?</p> </div>
</div>
<div class="col-md-4">
<div class="well select-next">
<a href="/api-integration.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z" fill="#fff"/></svg></a>
<p class="under-btn">怎样将现有的 Web API 整合到我的应用中?</p> </div>
</div>
<div class="col-md-4">
<div class="well select-next">
<a href="/deployment.html" class="btn btn-success btn-full"><svg width="28" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1792 640q0 26-19 45l-512 512q-19 19-45 19t-45-19-19-45v-256h-224q-98 0-175.5 6t-154 21.5-133 42.5-105.5 69.5-80 101-48.5 138.5-17.5 181q0 55 5 123 0 6 2.5 23.5t2.5 26.5q0 15-8.5 25t-23.5 10q-16 0-28-17-7-9-13-22t-13.5-30-10.5-24q-127-285-127-451 0-199 53-333 162-403 875-403h224v-256q0-26 19-45t45-19 45 19l512 512q19 19 19 45z" fill="#fff"/></svg></a>
<p class="under-btn">我已经创建了一个 Python Web 应用,那我如何部署呢?</p> </div>
</div>
</div><div id="mc_embed_signup">
<form action="//mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h4>在这里注册以便每月能收到一份邮件资料,内容包含本站的主要更新、教程和 Python 书籍的打折码等。</h4>
<div class="row">
<div class="col-md-9">
<input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="邮箱地址" required>
<div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" tabindex="-1" value=""></div>
</div>
<div class="col-md-3">
<div class="clear"><input type="submit" value="订阅" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="font-family: 'Helvetica Neue';"></div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="col-md-offset-1 col-md-3" id="sidebar">
<div class="panel">
<div class="panel-heading">
<h3 class="panel-head">赞助商</h3>
</div>
<div class="panel-body">
<a href="https://realpython.com/?utm_source=fsp&utm_medium=promo&utm_campaign=django"><img src="/img/sponsored/realpython.jpg" alt="Real Python logo" width="100%"></a>
<p style="font-size: .8em;">如果你要找一本循序渐进的 Django 教程,我推荐你
<a href="https://realpython.com/?utm_source=fsp&utm_medium=promo&utm_campaign=django" onclick="trackOutboundLink('https://realpython.com/?utm_source=fsp&utm_medium=promo&utm_campaign=django'); return false;">看看 Real Python</a>.
</p>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-head">邮件获取更新</h3>
</div>
<div class="panel-body">
<div id="mc_embed_signup">
<form action="//mattmakai.us2.list-manage.com/subscribe/post?u=b7e774f0c4f05dcebbfee183d&id=b22335388d" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<h5>注册以便每月能收到一份邮件资料,内容包含本站的主要更新和 Python 教程。</h5>
<input type="email" value="" name="EMAIL" class="email form-control" id="mce-EMAIL" placeholder="邮箱地址" required>
<div style="position: absolute; left: -5000px;"><input type="text" name="b_b7e774f0c4f05dcebbfee183d_b22335388d" tabindex="-1" value=""></div>
<input type="submit" value="订阅" name="subscribe" id="mc-embedded-subscribe" class="btn btn-success" style="font-family: 'Helvetica Neue'; margin-top: 5px;">
</div>
</form>
</div>
</div>
</div><div class="panel" id="full-toc">
<div class="panel-heading">
<h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">目录</a></h3>
</div>
<div class="list-group">
<a href="/introduction.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>1. 简介</a><a href="/learning-programming.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>学习编程</a><a href="/why-use-python.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>为什么用 Python?</a><a href="/python-2-or-3.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Python 2 还是 3?</a><a href="/enterprise-python.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>企业 Python</a><a href="/python-community.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Python Community</a><a href="/best-python-podcasts.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Best Python Podcasts</a><a href="/best-python-resources.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>最佳 Python 资源</a><a href="/best-python-videos.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>最佳 Python 视频</a><a href="/development-environments.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>2. 开发环境</a><a href="/vim.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Vim</a><a href="/emacs.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Emacs</a><a href="/python-programming-language.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>3. 核心语言</a><a href="/generators.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>生成器</a><a href="/comprehensions.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>推导式</a><a href="/web-development.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>4. Web 开发</a><a href="/web-frameworks.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Web 框架</a><a href="/django.html" class="list-group-item smaller-item active" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Django</a><a href="/flask.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Flask</a><a href="/bottle.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Bottle</a><a href="/pyramid.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Pyramid</a><a href="/morepath.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Morepath</a><a href="/other-web-frameworks.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>其它 Web 框架</a><a href="/web-design.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Web 设计</a><a href="/cascading-style-sheets.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>级联样式表 (CSS)</a><a href="/javascript.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>JavaScript</a><a href="/websockets.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>WebSockets</a><a href="/template-engines.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>模板引擎</a><a href="/web-application-security.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Web 应用安全</a><a href="/static-site-generator.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>静态网站生成器</a><a href="/jinja2.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Jinja2</a><a href="/data.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>5. 数据</a><a href="/databases.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>关系型数据库</a><a href="/no-sql-datastore.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>NoSQL 数据存储</a><a href="/object-relational-mappers-orms.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>对象关系映射器</a><a href="/postgresql.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>PostgreSQL</a><a href="/mysql.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>MySQL</a><a href="/sqlite.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>SQLite</a><a href="/application-programming-interfaces.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>6. Web APIs</a><a href="/api-integration.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>API 集成</a><a href="/api-creation.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>API 的创建</a><a href="/twilio.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Twilio</a><a href="/deployment.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>7. 部署</a><a href="/servers.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>服务器</a><a href="/platform-as-a-service.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>平台即服务(PaaS)</a><a href="/operating-systems.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>操作系统</a><a href="/web-servers.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Web 服务器</a><a href="/wsgi-servers.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>WSGI 服务器</a><a href="/source-control.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>源码控制</a><a href="/application-dependencies.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>应用程序依赖</a><a href="/static-content.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>静态内容</a><a href="/task-queues.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>任务队列</a><a href="/configuration-management.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>配置管理</a><a href="/continuous-integration.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>持续集成</a><a href="/logging.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>日志</a><a href="/monitoring.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>监控</a><a href="/web-analytics.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Web 分析</a><a href="/docker.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Docker</a><a href="/caching.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>缓存</a><a href="/microservices.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>微服务</a><a href="/devops.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>DevOps</a><a href="/nginx.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Nginx</a><a href="/apache-http-server.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Apache HTTP 服务器</a><a href="/caddy.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Caddy</a><a href="/green-unicorn-gunicorn.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Green Unicorn (Gunicorn)</a><a href="/ubuntu.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Ubuntu</a><a href="/pelican.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Pelican</a><a href="/lektor.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Lektor</a><a href="/mkdocs.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>MkDocs</a><a href="/testing.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>8. 测试</a><a href="/unit-testing.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>单元测试</a><a href="/integration-testing.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>集成测试</a><a href="/code-metrics.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>代码度量</a><a href="/debugging.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>调试</a><a href="/what-full-stack-means.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif;'>9. Meta</a><a href="/bots.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Bots</a><a href="/change-log.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Change Log</a><a href="/future-directions.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Future Directions</a><a href="/about-author.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>About the Author</a><a href="/sqlalchemy.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>SQLAlchemy</a><a href="/peewee.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",sans-serif; padding-left:27px'>Peewee</a> <a href="/table-of-contents.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",san-serif;background-color:#22B24C; color: #fff;'>...或者<span style="border-bottom: 1px dotted;">显示全部目录内容</span>.</a>
</div>
</div> <div class="panel">
<div class="panel-heading"><h3 class="panel-head">Django</h3></div>
<div class="panel-body">
重要的更新内容会通过 Twitter 账号<a href="https://twitter.com/fullstackpython">@fullstackpython</a>发布。
<hr/>
需要更加详细的教程吗?请看
<a href="http://www.deploypython.com/">《The Full Stack Python Guide to Deployments》。</a>
</div>
</div>
<div class="panel" id="mobile-toc">
<div class="panel-heading">
<h3 class="panel-head"><a href="/table-of-contents.html" style="color: #fff;">Chapters</a></h3>
</div>
<div class="list-group">
<a href="/introduction.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>1. 简介</a><a href="/development-environments.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>2. 开发环境</a><a href="/python-programming-language.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>3. 核心语言</a><a href="/web-development.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>4. Web 开发</a> <a href="/django.html" class="list-group-item smaller-item active" style='font-family: "Helvetica Neue",sans-serif;'>» Django</a>
<a href="/data.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>5. 数据</a><a href="/application-programming-interfaces.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>6. Web APIs</a><a href="/deployment.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>7. 部署</a><a href="/testing.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>8. 测试</a><a href="/what-full-stack-means.html" class="list-group-item smaller-item " style='font-family: "Helvetica Neue",sans-serif;'>9. Meta</a> <a href="/table-of-contents.html" class="list-group-item smaller-item" style='font-family: "Helvetica Neue",san-serif;background-color:#22B24C; color: #fff;'>...or <span style="border-bottom: 1px dotted;">view the full table of contents</span>.</a>
</div>
</div></div></div>
<hr/>
</div>
<div class="container">
<div class="footer pull-right">
This site is based on <a href="https://github.com/mattmakai">Matt Makai</a>'s project <a href="https://github.com/mattmakai/fullstackpython.com">Full Stack Python</a>, thanks for his excellent work!
</div>
</div>
<div class="container">
<div class="footer pull-right" style="text-align:right; font-size:85%;">
<p>此网站由 <a href="https://github.com/haiiiiiyun">@haiiiiiyun</a> 和 <a href="https://github.com/haiiiiiyun/fullstackpython.cn/graphs/contributors">开源爱好者们</a> 共同维护。
若发现错误或想贡献,请访问: <a href="https://github.com/haiiiiiyun/fullstackpython.cn/">Github fullstackpython.cn 项目</a>
</p>
</div>
</div><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-77551377-2', 'auto');
ga('send', 'pageview');
</script><script type='text/javascript'>
var trackOutboundLink = function(url) { ga('send', 'event', 'outbound', 'click', url, {'hitCallback': function () { document.location = url; } }); }
</script>
</body>
</html>