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
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
750
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
We Are The Robots
honzajavorek
0
400
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
940
Rails Girls Zürich Keynote
gr2m
96
14k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
570
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
990
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