-
Notifications
You must be signed in to change notification settings - Fork 20
/
databases.html
253 lines (252 loc) · 31.6 KB
/
databases.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
<!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="关系型数据库在很多 Python 应用的数据存储中起来了至关重要的作用。">
<title>数据库 - 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>数据库</h1>
<p>数据库是建立在操作系统的文件系统之上的一种抽象,它使得对持久性数据的创建、读取、更新和删除等的操作变得更加容易。</p>
<h2>为什么说数据库很有必要?</h2>
<p>Web 应用在更高的层次上存储数据并以更有用的方式将数据呈现给用户。例如,Google 存储道路相关的数据,但它通过 <a href="https://www.google.com/maps/">地图</a> 应用可向我们提供从一个地点到另一个地点的驾驶向导。因为数据是按结构化方式存储的,因此提供驾驶向导是可能的。</p>
<p>数据库使得结构化存储变得即可靠又快速。它们还提供了一种数据应该如何被保存和提取的认知模型,因而你无需在每次创建新应用时都要指出如何处理数据。</p>
<div class="well see-also">对数据库这个概念的实现有很多种,包括 <a href="/postgresql.html">PostgreSQL</a>、 <a href="/mysql.html">MySQL</a> 和 <a href="/sqlite.html">SQLite</a> 等。 还存在被称为 <a href="/no-sql-datastore.html">NoSQL 数据存储</a> 的非关系型数据库。到 <a href="/data.html">数据</a> 这一章学习更多的相关知识,或者到 <a href="/table-of-contents.html">总目录页</a> 去查看全部主题。</div>
<h2>关系型数据库</h2>
<p>Python Web 应用中用得最多的数据存储抽象是一组关系型数据表。另外的存储抽象会在 <a href="/no-sql-datastore.html">NoSQL</a> 页讲解。</p>
<p>关系型数据库将数据存储在一系列的数据表中。数据表之间的互连关系通过 <em>外键</em> 指定。外键是从一个关系型数据表的一行指向某表的另一行的一个唯一引用,被指向的某表可以和指向的表相同,但是通常是不同的表。</p>
<p>数据库存储的实现在复杂度上各有不同。SQLite,是一种包含在 Python 中的数据库系统,它为每个数据库创建一个单独的文件来存放数据。其它的数据库系统,如 <a href="/postgresql.html">PostgreSQL</a>、 <a href="/mysql.html">MySQL</a>、 Oracle 和 Microsoft SQL Server 都具有更加复杂的持久化方案,并且提供对 Web 应用很有用的额外高级功能。这些高级功能包括但不限于:</p>
<ol>
<li>一个主数据库和一个或多个只读从数据库实例之间的数据复制功能</li>
<li>能高效存储如 JavaScript 对象标记 (JSON) 等半结构化数据的高级列类型</li>
<li>允许在多个数据库间进行水平扩展的数据分片,分片以数据一致性的延迟为代价,使得每个分片都能作为一个可读写的实例使用。</li>
<li>监测、分析及能提供数据库模式和表的其它有用的运行时信息的功能。</li>
</ol>
<p>通常, Web 应用开始时只使用一个数据库实例,比如用只有一个直接模式的 PostgreSQL。随着时间的推移,数据库模式演变成了使用模式迁移的更加复杂的结构,而像复制、分片、监测等高级功能,随着应用用户的需求及数据库使用的增加,也变得越来越有用。</p>
<h2>Python Web 应用最常用的数据库</h2>
<p><a href="http://www.postgresql.org/">PostgreSQL</a> 和 <a href="http://www.mysql.com/">MySQL</a> 是用于存储 Python Web 应用数据的两个最常用的开源数据库。</p>
<p><a href="http://www.sqlite.org/">SQLite</a> 是一种将数据存储在存储器的单个文件上的数据库。 SQLite 内置在 Python 中,但是每次允许一个连接对它进行存取。因此强烈建议不要 <a href="https://docs.djangoproject.com/en/dev/ref/databases/#database-is-locked-errors">在 Web 应用的生产环境中使用 SQLite</a>。</p>
<h2>PostgreSQL</h2>
<p>PostgreSQL 是被推荐在 Python Web 应用中使用的一种关系型数据库。它的功能集、活跃的开发及稳定性使得当今数以百万计的 Web 应用都将它作为后端使用。</p>
<p>在 <a href="/postgresql.html">PostgreSQL 页</a> 上了解更多关于在 Python 中使用 PostgreSQL 的知识。</p>
<h2>MySQL</h2>
<p>MySQL 是能在 Python 应用中使用的另一种可靠的开源数据库实现。MySQL 相比 PostgreSQL 更易入门,但是它没有 PostgreSQL 功能丰富。</p>
<p>到专门的 <a href="/mysql.html">MySQL 页</a> 上了解有关在 Python 应用中使用 MySQL 的知识。</p>
<h2>用 Python 连接数据库</h2>
<p>要通过 Python 来处理关系型数据库,你需要使用代码库。 连接关系型数据库的最常用库是:</p>
<ul>
<li>
<p>连接 PostgreSQL 的 <a href="http://initd.org/psycopg/">psycopg2</a></p>
</li>
<li>
<p>连接 MySQL 的 <a href="https://pypi.python.org/pypi/MySQL-python/1.2.5">MySQLdb</a></p>
</li>
<li>
<p>连接 Oracle 的 <a href="http://cx-oracle.sourceforge.net/">cx_Oracle</a></p>
</li>
</ul>
<p>对 SQLite 的支持已内置于 Python 2.7+ 中,因此不需要另外的库。只需 "import sqlite3" 就能开始与这个基于单文件的数据库进行交互了。</p>
<h2>对象-关系 映射</h2>
<p>对象-关系 映射器 (ORM) 使得开发人员无需写 SQL 查询语句,而只需编写 Python 代码就能从后端存取数据。每个 Web 应用框架对 ORM 的集成处理都有所不同。有 <a href="/object-relational-mappers-orms.html">一整页是专门讲述对象-关系 映射</a> (ORM) 的,你应该可以通过它来了解这个主题知识。</p>
<h2>数据库第三方服务</h2>
<p>许多公司运营着可扩展的数据库服务器来提供托管服务。托管的数据库,根据提供商的不同,通常能提供自动化的备份和恢复,强化了的安全配置和方便的垂直扩展等功能。</p>
<ul>
<li>
<p><a href="http://aws.amazon.com/rds/">Amazon 关系型数据库服务 (RDS)</a> 提供预配置的 MySQL 和 PostgreSQL 实例。根据存储和性能的需求,这些实例可以按需扩大或缩小配置。</p>
</li>
<li>
<p><a href="https://developers.google.com/cloud-sql/">Google 云 SQL</a> 服务提供受控的、可备份、可复制和自动进行补丁更新的 MySQL 实例。云 SQL 与 Google App Engine 集成在一起,但是也可以单独使用。</p>
</li>
<li>
<p><a href="http://www.gobitcan.com/">BitCan</a> 同时提供 MySQL 和 MongoDB 托管服务器,并具有可扩展的备份服务。</p>
</li>
<li>
<p><a href="https://www.elephantsql.com/">ElephantSQL</a> 是一家 “服务即服务” 的公司,它托管 PostgreSQL 数据库,并且基于 Amazon Web 服务实例对服务器的配置、备份和数据连接进行处理。</p>
</li>
</ul>
<h2>通用数据库相关资源</h2>
<ul>
<li>
<p><a href="http://coding-geek.com/how-databases-work/">关系型数据库是如何运作的?</a> 这篇长文详细讲述了排序、查询、合并及其它我们使用像 PostgreSQL 等已连接的关系型数据库时常常熟视无睹的这些操作。</p>
</li>
<li>
<p><a href="https://medium.com/@jeeyoungk/why-i-love-databases-1d4cc433685f">我为什么喜欢数据库</a> 是一篇非常精彩的文章,讲述了 CAP 原理(CAP Theorem)、分布式系统以及有关数据库理论和实现的核心知识的其它主题。</p>
</li>
<li>
<p><a href="http://www.craigkerstiens.com/2016/01/08/writing-better-sql/">编写更好的 SQL 代码</a> 这篇简短的代码风格指南能教你编写出更加易读的查询语句。</p>
</li>
<li>
<p><a href="http://db-engines.com/en/ranking">数据库引擎</a> 对最流行的数据库管理系统进行了排序。</p>
</li>
<li>
<p><a href="http://dbweekly.com/">数据库周刊</a> 是一份关于通用数据库的文章和资源的每周集锦。</p>
</li>
<li>
<p><a href="https://julien.danjou.info/blog/2014/db-integration-testing-strategies-python">数据库集成测试策略</a> 讲述的这个不一样的主题,在每一个现实项目中都会碰到。</p>
</li>
<li>
<p><a href="http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/">异步 Python 和数据库</a> 这篇文章就阻塞与异步事件模型的差异,导致许多 Python 数据库驱动不进行修改不能使用这个问题进行了深入的讲解。假如你想通过 Tornado 或 gevent 使用 <a href="/websockets.html">WebSockets</a> 的话,绝对值得一读。</p>
</li>
<li>
<p><a href="http://www.pg-versus-ms.com/">PostgreSQL vs. MS SQL 服务器</a> 以一个数据分析师的视角对这两个数据库服务器之间的区别进行了说明。</p>
</li>
</ul>
<h2>数据库学习清单</h2>
<ol>
<li>
<p>在你的服务器上安装 PostgreSQL。假设你在 Ubuntu 上使用以下命令安装:
<code>sudo apt-get install postgresql</code>。</p>
</li>
<li>
<p>确保 <a href="http://initd.org/psycopg/">psycopg2</a> 库在你的应用的依赖文件中。</p>
</li>
<li>
<p>配置你的 Web 应用,使其连接到这个 PostgreSQL 实例。</p>
</li>
<li>
<p>可以通过 Django <a href="https://docs.djangoproject.com/en/dev/topics/db/">内置的 ORM</a> 或者 <a href="http://www.sqlalchemy.org/">Flask 的 SQLAlchemy</a>,在你的 ORM 中创建数据模型。</p>
</li>
<li>
<p>创建数据库表,或者如果使用了 ORM 的话,将你的 ORM 模型与 PostgreSQL 实例进行同步。</p>
</li>
<li>
<p>通过你的 Web 应用,开始在数据库中创建、读取、更新和删除数据。</p>
</li>
</ol>
<h3>还需要什么才能运行你的应用?</h3>
<div class="row">
<div class="col-md-4">
<div class="well select-next">
<a href="/no-sql-datastore.html" class="btn btn-success btn-full"><svg width="34" height="30" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1151 960h316q-1-3-2.5-8t-2.5-8l-212-496h-708l-212 496q-1 2-2.5 8t-2.5 8h316l95 192h320zm513 30v482q0 26-19 45t-45 19h-1408q-26 0-45-19t-19-45v-482q0-62 25-123l238-552q10-25 36.5-42t52.5-17h832q26 0 52.5 17t36.5 42l238 552q25 61 25 123z" fill="#fff"/></svg></a>
<p class="under-btn">那些时髦的开发者一直谈论的 NoSQL 数据存储到底是什么?</p> </div>
</div>
<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="/javascript.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="M1152 896q0-106-75-181t-181-75-181 75-75 181 75 181 181 75 181-75 75-181zm512-109v222q0 12-8 23t-20 13l-185 28q-19 54-39 91 35 50 107 138 10 12 10 25t-9 23q-27 37-99 108t-94 71q-12 0-26-9l-138-108q-44 23-91 38-16 136-29 186-7 28-36 28h-222q-14 0-24.5-8.5t-11.5-21.5l-28-184q-49-16-90-37l-141 107q-10 9-25 9-14 0-25-11-126-114-165-168-7-10-7-23 0-12 8-23 15-21 51-66.5t54-70.5q-27-50-41-99l-183-27q-13-2-21-12.5t-8-23.5v-222q0-12 8-23t19-13l186-28q14-46 39-92-40-57-107-138-10-12-10-24 0-10 9-23 26-36 98.5-107.5t94.5-71.5q13 0 26 10l138 107q44-23 91-38 16-136 29-186 7-28 36-28h222q14 0 24.5 8.5t11.5 21.5l28 184q49 16 90 37l142-107q9-9 24-9 13 0 25 10 129 119 165 170 7 8 7 22 0 12-8 23-15 21-51 66.5t-54 70.5q26 50 41 98l183 28q13 2 21 12.5t8 23.5z" fill="#fff"/></svg></a>
<p class="under-btn">在我的 Python Web 应用中如何使用 JavaScript?</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 panel-success">
<div class="panel-body">
<a href="http://www.deploypython.com/"><img src="/img/sponsored/fsp-deployment-guide.png" alt="The Full Stack Python Guide to Deployments" width="100%"></a>
<p style="font-size: .8em; margin-top: 10px;">想找到一个完整的,一步一步的部署方案吗?请看<a href="http://www.deploypython.com/">《The Full Stack Python Guide to Deployments》</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" 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 active" 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">数据库</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="/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 active" style='font-family: "Helvetica Neue",sans-serif;'>» 关系型数据库</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>