Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
deploying_django.pdf
Search
Bob Wei
April 22, 2014
23
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
deploying_django.pdf
Bob Wei
April 22, 2014
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
The Language of Interfaces
destraynor
162
27k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
2.2k
My Coaching Mixtape
mlcsv
0
380
Building an army of robots
kneath
307
47k
Prompt Engineering for Job Search
mfonobong
0
580
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
121
120k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
Evolving SEO for Evolving Search Engines
ryanjones
0
360
Transcript
Deploying Django
今⽇日主題 • 系統架構 • 執⾏行 Django Web 應⽤用程式 • 部署⼯工具
( Fabric ) • 靜態檔案部署 ( Collectstatic ) • A Real World Example
Django Django Django Celery Celery Static Media 背景⼯工作伺服器 SQL db
關聯式資料庫伺服器 Redis 資料庫伺服器 靜態檔案伺服器 應⽤用程式伺服器 Cache 快取伺服器
執⾏行 Django Web 應⽤用程式 • Development • ./manage.py runserver •
可處理的 request 次數較少 • Production • gunicorn project.wsgi -b 0.0.0.0:$PORT -w 3
Gunicorn • Gunicorn (‘Green Unicorn’) is a pure-Python WSGI server
for UNIX. It has no dependencies and is easy to install and use • 安裝 : pip install gunicorn
部署⼯工具 ( Fabric ) • ⽤用來建⽴立⾃自動化部署流程的⼯工具 • 簡化部署流程 • 易於⼤大量部署程式碼⾄至應⽤用程式伺服器
靜態檔案部署 ( Collectstatic ) • 靜態檔案伺服器與應⽤用程式伺服器分離 • ./manage.py collectstatic 將靜態檔案部署⾄至靜態檔案伺服器
Django
Deploy to Heroku • 前置作業 • 定義 Procfile => 設定如何執⾏行你的
Web App • 定義 requirements.txt => 設定所需要的 Dependency • 定義 Database 的位置,並以環境變數 DATABASE_URL 的形式告知 Web App • 定義 STATICFILES_STORAGE
Deploy to Heroku • 部署應⽤用程式⾄至 Heroku • git push heroku
master • 部署靜態檔案⾄至靜態檔案伺服器 • ./manage.py collectstatic —noinput