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
25
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
deploying_django.pdf
Bob Wei
April 22, 2014
Transcript
10 slides
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
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
3k
Believing is Seeing
oripsolob
1
290
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
370
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
Ethics towards AI in product and experience design
skipperchong
2
480
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
710
Exploring anti-patterns in Rails
aemeredith
4
590
Evolving SEO for Evolving Search Engines
ryanjones
0
380
How to make the Groovebox
asonas
2
2.6k
Marketing to machines
jonoalderson
1
6k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k