基本介紹
- 中文名:Django 3.0入門與實踐
- 作者:李健
- 出版社:清華大學出版社
- ISBN:9787302567141
內容簡介,圖書目錄,
內容簡介
本書是一執行緒序員多年開發經驗的結晶。書中深入淺出地講解了使用Django開發Web網站所需的配置、後台、路由系統、模型、視圖、模板、表單系統、中間件、自動化測試、國際化及本地化、安全和部署等內容,幫助讀者快速進入Web項目開發,在項目實踐中靈活套用各種開發技術和方法。本書主要包含四部分:第一部分(第1章)為讀者介紹Django的發展狀況以及如何搭建Django開發環境;第二部分(第2章)主要介紹什麼是Web開發框架並通過搭建一個簡單的Web框架幫助讀者理解Web框架的工作原理;第三部分(第3章)帶領讀者搭建一個網站,使讀者能夠從整體上了解Django;第四部分(第4~16章)詳細介紹Django各個模組的工作原理,通過學習這部分內容,讀者將能夠獨立開發Django套用。本書可供Web開發國中級讀者以及希望使用Python作為程式語言的軟體開發工程師參考。
圖書目錄
目錄
第1章 走進Django的世界 ················1
1.1 認識Django ··································1
1.2 版本選擇 ·····································1
1.3 搭建開發環境 ·······························2
1.3.1 安裝Python ································2
1.3.2 安裝Django ································2
第2章 Web開發框架 ·······················4
2.1 Socket編程 ··································4
2.2 MTV框架 ····································6
第3章 搭建第一個Django網站 ··········8
3.1 創建項目 ·····································8
3.2 運行項目 ·····································9
3.3 創建投票套用 ·····························10
3.4 開發第一個視圖 ··························11
3.5 配置資料庫 ································12
3.6 創建模型 ···································13
3.7 激活模型 ···································14
3.8 Django管理頁面 ··························15
3.9 向管理頁面中添加投票套用 ···········16
3.10 添加視圖 ··································18
3.10.1 擴展視圖 ································19
3.10.2 處理404錯誤 ··························21
3.11 使用模板系統 ····························22
3.11.1 模板中的超連結 ·······················23
3.11.2 為超連結添加命名空間 ··············23
3.12 HTML表單 ·······························24
3.13 添加樣式 ··································27
3.14 本地化 ·····································28
3.15 小結 ········································29
第4章 django-admin和manage.py ····30
4.1 help ··········································31
4.2 version·······································32
4.3 check ········································32
4.4 compilemessages ··························32
4.5 createcachetable ····························34
4.6 dbshell ·······································34
4.7 diffsettings ··································35
4.8 dumpdata····································35
4.9 flush··········································36
4.10 inspectdb ··································36
4.11 loaddata ····································38
4.12 makemessages ····························38
4.13 startproject ································39
4.14 startapp ····································39
4.15 runserver···································40
4.16 sendtestemail······························40
4.17 shell ········································41
4.18 遷移 ········································41
4.18.1 makemigrations ························41
4.18.2 migrate ···································42
4.18.3 sqlmigrate ·······························43
4.18.4 showmigrations ·························43
4.19 changepassword ··························44
4.20 createsuperuser ···························44
4.21 collectstatic································44
4.22 findstatic ···································45
4.23 默認選項 ··································45
第5章 配置 ···································46
5.1 Django配置檔案 ··························46
5.1.1 引用Django配置信息 ·······················47
5.1.2 django.setup ·········································47
5.2 Cache ······················································48
5.2.1 CACHES ·············································48
5.2.2 CACHE_MIDDLEWARE_ALIAS: ····49
5.2.3 CACHE_MIDDLEWARE_KEY_PREFIX: ··············································49
5.2.4 CACHE_MIDDLEWARE_SECONDS: ··········································49
5.3 資料庫 ····················································50
5.3.1 DATABASES ······································50
5.3.2 DATABASE_ROUTERS ····················54
5.3.3 DEFAULT_INDEX_TABLESPACE···57
5.3.4 DEFAULT_TABLESPACE ·················57
5.4 調試 ························································57
5.4.1 DEBUG ···············································57
5.4.2 DEBUG_PROPAGATE_EXCEPTIONS ·····································58
5.5 電子郵件 ················································58
5.5.1 ADMINS ·············································58
5.5.2 DEFAULT_FROM_EMAIL ················59
5.5.3 EMAIL_BACKEND ···························59
5.5.4 EMAIL_HOST ····································59
5.5.5 EMAIL_HOST_USER ························59
5.5.6 EMAIL_HOST_PASSWORD ·············59
5.5.7 EMAIL_PORT ·····································59
5.5.8 EMAIL_TIMEOUT ·····························59
5.5.9 SERVER_EMAIL ································59
5.5.10 MANAGERS ·····································60
5.6 檔案上傳 ················································60
5.6.1 DEFAULT_FILE_STORAGE ·············60
5.6.2 FILE_CHARSET ·································60
5.6.3 FILE_UPLOAD_HANDLERS ···········60
5.6.4 FILE_UPLOAD_MAX_MEMORY_SIZE ·····················································60
5.6.5 FILE_UPLOAD_PERMISSIONS·······60
5.6.6 FILE_UPLOAD_DIRECTORY_PERMISSIONS ···································60
5.6.7 FILE_UPLOAD_TEMP_DIR ·············61
5.6.8 MEDIA_ROOT ···································61
5.6.9 MEDIA_URL ······································61
5.6.10 靜態檔案 ···········································62
5.7 表單 ························································63
5.8 國際化(i18n/l10n) ································63
5.8.1 DECIMAL_SEPARATOR···················63
5.8.2 NUMBER_GROUPING ·····················63
5.8.3 THOUSAND_SEPARATOR ···············65
5.8.4 USE_THOUSAND_SEPARATOR ·····66
5.8.5 FIRST_DAY_OF_WEEK ···················66
5.8.6 DATE_FORMAT ·································66
5.8.7 DATE_INPUT_FORMATS ·················66
5.8.8 DATETIME_FORMAT ·······················67
5.8.9 SHORT_DATE_FORMAT ··················67
5.8.10 SHORT_DATETIME_FORMAT ······67
5.8.11 DATETIME_INPUT_FORMATS ·····67
5.8.12 TIME_FORMAT ·······························68
5.8.13 TIME_INPUT_FORMATS ···············68
5.8.14 YEAR_MONTH_FORMAT ·············68
5.8.15 MONTH_DAY_FORMAT ················68
5.8.16 TIME_ZONE ·····································69
5.8.17 LANGUAGE_CODE ························69
5.8.18 LANGUAGE_COOKIE_AGE ··········69
5.8.19 LANGUAGE_COOKIE_DOMAIN ···········································69
5.8.20 LANGUAGE_COOKIE_NAME ······70
5.8.21 LANGUAGE_COOKIE_PATH ········70
5.8.22 LANGUAGES ···································70
5.8.23 LANGUAGES_BIDI·························70
5.8.24 LOCALE_PATHS ······························70
5.8.25 USE_I18N ·········································70
5.8.26 USE_L10N ········································71
5.8.27 USE_TZ ·············································71
5.8.28 Python datetime語法 ························71
5.9 HTTP ······················································71
5.9.1 DATA_UPLOAD_MAX_MEMORY_SIZE ·····················································71
5.9.2 DATA_UPLOAD_MAX_NUMBER_FIELDS ················································72
5.9.3 DEFAULT_CHARSET ·······················72
5.9.4 DISALLOWED_USER_AGENTS ·····72
5.9.5 FORCE_SCRIPT_NAME ···················72
5.9.6 INTERNAL_IPS ·································72
5.9.7 SECURE_BROWSER_XSS_FILTER ················································73
5.9.8 SECURE_CONTENT_TYPE_NOSNIFF·············································73
5.9.9 SECURE_HSTS_INCLUDE_SUBDOMAINS ···································73
5.9.10 SECURE_HSTS_PRELOAD ············73
5.9.11 SECURE_HSTS_SECONDS ············73
5.9.12 SECURE_PROXY_SSL_HEADER ·············································74
5.9.13 SECURE_REDIRECT_EXEMPT ····74
5.9.14 SECURE_REFERRER_POLICY ·····75
5.9.15 SECURE_SSL_HOST ·······················75
5.9.16 SECURE_SSL_REDIRECT ·············75
5.9.17 SIGNING_BACKEND ·····················75
5.9.18 WSGI_APPLICATION ·····················75
5.10 安全 ······················································75
5.10.1 SECRET_KEY ··································75
5.10.2 ALLOWED_HOSTS ·························76
5.11 CSRF ····················································76
5.11.1 CSRF_COOKIE_AGE ······················76
5.11.2 CSRF_COOKIE_DOMAIN ··············77
5.11.3 CSRF_COOKIE_HTTPONLY ··········77
5.11.4 CSRF_COOKIE_NAME ···················77
5.11.5 CSRF_COOKIE_PATH ·····················77
5.11.6 CSRF_COOKIE_SAMESITE ···········77
5.11.7 CSRF_COOKIE_SECURE ···············77
5.11.8 CSRF_USE_SESSIONS ····················78
5.11.9 CSRF_FAILURE_VIEW ···················78
5.11.10 CSRF_HEADER_NAME ················78
5.11.11 CSRF_TRUSTED_ORIGINS ·········78
5.11.12 代碼示例 ·········································78
5.12 模型 ······················································81
5.12.1 ABSOLUTE_URL_OVERRIDES ····81
5.12.2 FIXTURE_DIRS ·······························81
5.12.3 INSTALLED_APPS ··························81
5.13 日誌 ······················································81
5.13.1 LOGGING ·········································81
5.13.2 LOGGING_CONFIG ························82
5.14 模板 ······················································82
5.15 URLs ····················································83
5.15.1 ROOT_URLCONF ····························83
5.15.2 APPEND_SLASH ·····························83
5.15.3 PREPEND_WWW ····························84
5.16 其他 ······················································84
5.16.1 DEFAULT_EXCEPTION_REPORTER_FILTER ························84
5.16.2 MIDDLEWARE ································84
第6章 後台管理頁面 ·······················85
6.1 ModelAdmin屬性 ·································85
6.1.1 date_hierarchy ·····································86
6.1.2 actions_on_top/actions_on_bottom ·····88
6.1.3 actions_selection_counter ····················88
6.1.4 empty_value_display ···························89
6.1.5 exclude ·················································90
6.1.6 fi elds·····················································91
6.1.7 fi eldsets ················································92
6.1.8 fi lter_horizontal ···································94
6.1.9 fi lter_vertical ········································95
6.1.10 form ···················································96
6.1.11 formfi eld_overrides ····························96
6.1.12 inlines·················································97
6.1.13 list_display ·········································97
6.1.14 list_display_links ·····························100
6.1.15 list_editable ······································101
6.1.16 list_fi lter ···········································102
6.1.17 list_per_page ····································102
6.1.18 list_max_show_all ···························103
6.1.19 list_select_related ····························103
6.1.20 ordering ············································104
6.1.21 paginator ··········································104
6.1.22 prepopulated_fi elds ··························104
6.1.23 preserve_fi lters·································104
6.1.24 radio_fi elds ······································105
6.1.25 autocomplete_fi elds ·························105
6.1.26 raw_id_fi elds ···································106
6.1.27 readonly_fi elds·································107
6.1.28 save_as ·············································107
6.1.29 save_as_continue ·····························107
6.1.30 save_on_top ·····································108
6.1.31 search_fi elds ····································108
6.1.32 show_full_result_count ···················110
6.1.33 sortable_by·······································110
6.1.34 view_on_site ····································110
6.1.35 自定義模板 ····································· 111
6.2 ModelAdmin 方法 ·······························112
6.2.1 save_model ········································112
6.2.2 delete_model ······································113
6.2.3 delete_queryset ··································113
6.2.4 save_formset ······································113
6.2.5 get_ordering ·······································114
6.2.6 get_search_results() ···························114
6.2.7 save_related ·······································114
6.2.8 get_autocomplete_fi elds ····················115
6.2.9 get_readonly_fi elds ····························115
6.2.10 get_prepopulated_fi elds ···················115
6.2.11 get_list_display ································115
6.2.12 get_list_display_links ······················115
6.2.13 get_exclude ······································115
6.2.14 get_fi elds ··········································115
6.2.15 get_fi eldsets ·····································115
6.2.16 get_list_fi lter ····································115
6.2.17 get_list_select_related ·····················116
6.2.18 get_search_fi elds ·····························116
6.2.19 get_sortable_by ································116
6.2.20 get_inline_instances·························116
6.2.21 get_inlines ········································116
6.2.22 get_urls ············································116
6.2.23 get_form···········································117
6.2.24 get_formsets_with_inlines ···············117
6.2.25 formfi eld_for_foreignKey ···············118
6.2.26 formfi eld_for_manytomany ·············118
6.2.27 formfi eld_for_choice_fi eld ··············118
6.2.28 get_changelist ··································119
6.2.29 get_changelist_form ························119
6.2.30 get_changelist_formset ····················119
6.2.31 lookup_allowed ·······························119
6.2.32 has_view_permission·······················120
6.2.33 has_add_permission·························120
6.2.34 has_change_permission ···················120
6.2.35 has_delete_permission ·····················120
6.2.36 has_module_permission ··················120
6.2.37 get_queryset ·····································120
6.2.38 message_user ···································121
6.2.39 get_paginator ···································121
6.2.40 response_add ···································121
6.2.41 response_change ······························121
6.2.42 response_delete ································121
6.2.43 get_changeform_initial_data ···········122
6.2.44 get_deleted_objects ·························122
6.2.45 add_view ··········································123
6.2.46 change_view ····································123
6.2.47 changelist_view ·······························123
6.2.48 delete_view ······································123
6.2.49 history_view ····································123
6.3 ModelAdmin資源 ·······························123
6.4 定製驗證功能 ······································124
6.5 InlineModelAdmin ·······························124
6.5.1 InlineModelAdmin.model ·················125
6.5.2 InlineModelAdmin.fk_name ·············125
6.5.3 InlineModelAdmin.formset ···············125
6.5.4 InlineModelAdmin.form····················125
6.5.5 InlineModelAdmin.classes ················125
6.5.6 InlineModelAdmin.extra ···················125
6.5.7 InlineModelAdmin.max_num ···········126
6.5.8 InlineModelAdmin.min_num ············126
6.5.9 InlineModelAdmin.raw_id_fi elds······127
6.5.10 InlineModelAdmin.template············128
6.5.11 InlineModelAdmin.verbose_name ···128
6.5.12 InlineModelAdmin.verbose_name_plural ················································128
6.5.13 InlineModelAdmin.can_delete ········128
6.5.14 InlineModelAdmin.show_change_link ···················································129
6.5.15 InlineModelAdmin.get_formset(request, obj=None, **kwargs) ·······129
6.5.16 InlineModelAdmin.get_extra(request,obj=None, **kwargs) ······················129
6.5.17 InlineModelAdmin.get_max_num(request, obj=None, **kwargs) ·······129
6.5.18 InlineModelAdmin.get_min_num(request, obj=None, **kwargs) ·······130
6.5.19 InlineModelAdmin.has_add_permission(request, obj) ··················130
6.5.20 InlineModelAdmin.has_change_permission(request, obj=None) ·······130
6.5.21 InlineModelAdmin.has_delete_permission(request, obj=None) ·······130
6.5.22 使用中間模型處理 ManyToMany關係 ·················································130
6.6 重寫管理後台模板 ······························131
6.6.1 新建管理後台模板 ···························131
6.6.2 重寫與替換 ·······································133
6.6.3 可重寫模板 ·······································134
6.6.4 根模板和登錄模板 ···························134
6.7 AdminSite ·············································134
6.7.1 重寫AdminSite ·································134
6.7.2 多管理後台的實現 ···························136
第7章 路由系統 ···························137
7.1 Django處理HTTP請求的流程 ·········137
7.2 URLconf示例 ······································137
7.3 URL參數類型轉化器 ·························138
7.4 自定義URL參數類型轉化器 ············138
7.5 使用正則表達式 ··································140
7.6 導入其他URLconf ······························140
7.7 向視圖傳遞額外參數 ··························141
7.8 動態生成URL ·····································142
7.9 URL名字和命名空間 ·························143
第8章 模型 ·································145
8.1 模型簡介 ··············································145
8.2 使用模型 ··············································145
8.3 欄位 ······················································146
8.3.1 AutoField ···········································146
8.3.2 BigAutoField ·····································146
8.3.3 BinaryField ········································146
8.3.4 BooleanField ······································146
8.3.5 CharField ···········································147
8.3.6 DateField ···········································147
8.3.7 DateTimeField ···································148
8.3.8 DecimalField ·····································148
8.3.9 EmailField ·········································149
8.3.10 FileField ···········································149
8.3.11 FilePathField ····································150
8.3.12 FloatField ·········································151
8.3.13 ImageField ·······································151
8.3.14 IntegerField ······································151
8.3.15 GenericIPAddressField ····················151
8.3.16 PositiveIntegerField ·························152
8.3.17 PositiveSmallIntegerField ···············152
8.3.18 SlugField ··········································152
8.3.19 SmallIntegerField ····························152
8.3.20 TextField ··········································152
8.3.21 TimeField ·········································152
8.3.22 URLField ·········································152
8.3.23 UUIDField ·······································152
8.4 欄位參數 ··············································153
8.4.1 null ·····················································153
8.4.2 blank ··················································153
8.4.3 choices ···············································153
8.4.4 default ················································156
8.4.5 help_text ············································156
8.4.6 primary_Key ······································156
8.4.7 unique ················································156
8.4.8 verbose_name ····································156
8.5 表與表之間關係 ··································157
8.5.1 多對一關係 ·······································157
8.5.2 多對多關係 ·······································157
8.5.3 一對一關係 ·······································158
8.6 模型元屬性 ··········································158
8.7 元屬性 ··················································158
8.7.1 abstract ···············································159
8.7.2 app_label ············································159
8.7.3 base_manager_name ··························159
8.7.4 db_table ·············································159
8.7.5 get_latest_by ······································159
8.7.6 order_with_respect_to ·······················159
8.7.7 ordering ··············································160
8.7.8 Indexes ···············································160
8.7.9 constraints ··········································161
8.7.10 verbose_name ··································161
8.7.11 verbose_name_plural ·······················161
8.8 Manager 類 ···········································161
8.8.1 自定義Manager類 ···························162
8.8.2 直接執行SQL語句 ··························162
8.8.3 執行存儲過程 ···································165
8.9 數據增刪改查 ······································165
8.10 數據操作進階——QuerySets ···········171
8.10.1 創建對象 ·········································172
8.10.2 修改對象 ·········································172
8.10.3 更新ForeignKey ·····························172
8.10.4 更新ManyToManyField ·················173
8.10.5 數據查詢 ·········································174
8.10.6 鏈式過濾器 ·····································179
8.10.7 查詢條件 ·········································180
8.10.8 模型深度檢索 ·································183
8.10.9 多條件查詢 ·····································184
8.10.10 主鍵查詢 ·······································185
8.10.11 查詢條件中的%和_ ···················185
8.10.12 F()函式 ·········································186
8.10.13 Func()表達式································187
8.10.14 QuerySet和快取 ···························188
8.10.15 複雜查詢與Q對象 ······················189
8.10.16 模型比較 ·······································190
8.10.17 複製模型實例 ·······························190
8.10.18 批量更新 ·······································190
8.10.19 模型關係 ·······································191
第9章 視圖 ·································193
9.1 視圖結構 ··············································193
9.2 HTTP狀態處理 ···································193
9.3 捷徑 ··············································195
9.3.1 render_to_string() ······························195
9.3.2 render() ··············································195
9.3.3 redirect() ············································196
9.3.4 get_object_or_404()···························197
9.3.5 get_list_or_404() ·······························198
9.4 視圖裝飾器 ··········································198
9.4.1 HTTP方法裝飾器 ····························199
9.4.2 GZip壓縮 ··········································199
9.4.3 Vary ····················································200
9.4.4 快取 ···················································201
9.5 Django內置視圖 ·································202
9.5.1 serve ···················································202
9.5.2 錯誤視圖 ···········································203
9.6 HttpRequest對象 ·································204
9.6.1 屬性 ···················································204
9.6.2 中間件屬性 ·······································205
9.6.3 方法 ···················································206
9.6.4 QueryDict對象 ·································207
9.7 HttpResponse對象 ·······························208
9.7.1 屬性 ···················································209
9.7.2 方法 ···················································210
9.7.3 HttpResponse子類 ····························211
9.7.4 JsonResponse ·····································211
9.7.5 FileResponse ······································212
9.8 TemplateResponse對象 ·······················212
9.8.1 SimpleTemplateResponse對象 ·········212
9.8.2 TemplateResponse對象 ····················213
9.8.3 TemplateResponse對象渲染過程 ····214
9.8.4 回調函式 ···········································215
9.8.5 使用TemplateResponse對象 ···········215
9.9 檔案上傳 ··············································216
9.9.1 單一檔案上傳 ···································216
9.9.2 多檔案上傳 ·······································218
9.9.3 臨時檔案 ···········································219
9.10 類視圖 ················································219
9.10.1 類視圖入門 ·····································219
9.10.2 繼承類視圖 ·····································220
9.11 通用視圖 ············································220
9.11.1 通用視圖 ·········································220
9.11.2 修改通用視圖屬性 ·························222
9.11.3 添加額外的上下文對象 ·················222
9.11.4 queryset屬性 ···································223
9.11.5 動態過濾 ·········································224
9.11.6 通用視圖與模型 ·····························225
9.12 表單視圖 ············································225
9.12.1 編輯表單視圖 ·································226
9.12.2 當前用戶 ·········································228
第10章 模板 ·······························230
10.1 載入模板 ············································230
10.2 模板語言 ············································231
10.2.1 變數 ·················································231
10.2.2 標籤 ·················································232
10.2.3 人性化語義標籤 ·····························236
10.2.4 過濾器 ·············································239
10.2.5 注釋 ·················································241
10.3 自定義標籤和過濾器 ························241
10.3.1 編寫自定義過濾器 ·························242
10.3.2 編寫自定義標籤 ·····························243
10.4 模板繼承 ············································244
第11章 表單系統 ·························250
11.1 Form類 ··············································250
11.2 表單欄位類型 ····································251
11.3 表單欄位通用屬性 ····························255
11.4 表單與模板 ········································255
第12章 中間件 ····························257
12.1 快取中間件 ········································257
12.2 通用中間件 ········································258
12.3 GZip中間件 ·······································258
12.4 有條件的GET中間件 ······················258
12.5 語言環境的中間件 ····························258
12.6 訊息中間件 ········································259
12.7 安全中間件 ········································259
12.8 會話中間件 ········································259
12.9 站點中間件 ········································259
12.10 身份驗證中間件 ······························259
12.11 CSRF保護中間件 ···························260
12.12 X-Frame-Options中間件 ·················260
12.13 中間件排序 ······································260
12.14 開發中間件 ······································261
第13章 自動化測試 ······················263
13.1 編寫第一個測試用例 ························263
13.2 執行測試用例 ····································264
13.3 修改代碼中的bug ·····························264
13.4 邊界值測試 ········································265
13.5 測試自定義視圖 ································266
13.6 測試DetailView ·································268
第14章 國際化和本地化 ················270
14.1 名詞解釋 ············································270
14.2 翻譯概述 ············································271
14.3 在Python中進行國際化 ···················271
14.3.1 注釋 ·················································272
14.3.2 空操作 ·············································273
14.3.3 複數 ·················································273
14.3.4 上下文標記 ·····································274
14.3.5 延遲翻譯 ·········································275
14.3.6 本地化的語言名 ·····························276
14.4 編寫模板代碼 ····································277
14.4.1 trans ·················································277
14.4.2 blocktrans·········································278
14.4.3 注釋 ·················································279
14.5 翻譯原理 ············································279
第15章 安全 ·······························282
15.1 網路攻擊與保護 ································282
15.1.1 跨站腳本攻擊 ·································282
15.1.2 跨站請求偽造攻擊 ·························283
15.1.3 SQL注入 ·········································284
15.1.4 點擊劫持 ·········································284
15.2 檢查配置信息 ····································284
第16章 部署 ·······························286
16.1 WSGI和Application對象 ················286
16.2 Ubuntu部署Django ··························286
16.2.1 查看系統版本 ·································286
16.2.2 更換國內源 ·····································286
16.2.3 查看Python版本 ····························287
16.2.4 安裝pip3 ·········································288
16.2.5 安裝nginx ·······································289
16.2.6 安裝Django ····································289
16.2.7 安裝uwsgi ·······································289
16.2.8 命令行運行網站 ·····························290
16.2.9 配置uwsgi ·······································290
16.2.10 配置nginx ·····································291
16.2.11 啟動網站 ·······································291
16.2.12 設定靜態檔案 ·······························292
16.2.13 自啟動服務 ···································293
16.3 CentOS部署Django ··························293
16.3.1 查看系統版本 ·································293
16.3.2 更換國內源 ·····································294
16.3.3 更新Python ·····································294
16.3.4 安裝Django ····································296
16.3.5 安裝uwsgi ·······································296
16.3.6 命令行運行網站 ·····························296
16.3.7 配置uwsgi ·······································296
16.3.8 安裝nginx ·······································297
16.3.9 自啟動服務 ·····································298
附錄A 語言碼 ······························299
附錄B 日期格式化字元串 ···············301