Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Deploying Django
Search
Brian Riley
February 22, 2012
850
12
Share
Deploying Django
Presenting my setup at LA Django Meetup Feb. 21, 2012.
Brian Riley
February 22, 2012
More Decks by Brian Riley
See All by Brian Riley
Python for the Ruby Programmer
brianriley
0
230
Debugging your gunicorns
brianriley
2
170
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
350
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
Scaling GitHub
holman
464
140k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
1
130
Building Adaptive Systems
keathley
44
3k
Become a Pro
speakerdeck
PRO
31
6k
WCS-LA-2024
lcolladotor
0
610
The Pragmatic Product Professional
lauravandoore
37
7.3k
Crafting Experiences
bethany
1
160
The browser strikes back
jonoalderson
0
1.1k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Transcript
DEPLOYING DJANGO Brian Riley @btriley
DEPLOYING DJANGO or, you could just use Heroku Brian Riley
@btriley
WHO AM I? • been working with Django since 2006
• put Django into production many times, using just about every setup • work at EdgeCast
DEPLOYING IS CONFUSING • gunicorn or uwsgi • nginx or
apache • ? or ? or, you could just use Heroku
THE STACK
THE STACK: WEB SERVER • serving static media files •
proxying to dynamic applications “nginx is an HTTP and reverse proxy server”
NGINX CONF server { listen 80 default; server_name example.com; location
/static/ { root /path/to/project; } location / { proxy_pass http://127.0.0.1:8000; } }
THE STACK: WSGI SERVER “Gunicorn 'Green Unicorn' is a Python
WSGI HTTP Server for UNIX” ./manage.py run_gunicorn
UPSTART • comes with Ubuntu • automates startup/shutdown of processes
• use to manage your gunicorn service: service gunicorn [start | stop | restart]
description "Gunicorn for my Django application" start on runlevel [2345]
stop on runlevel [!2345] #Send KILL after 5 seconds kill timeout 5 respawn env PROJECT_ROOT="/opt/my_django_app" script exec python $PROJECT_ROOT/portal/manage.py run_gunicorn -- settings=settings.production --preload -w 16 --log-level debug --log- file /var/log/my_django_app/gunicorn.log -p /var/run/gunicorn.pid end script /etc/init/gunicorn.conf
AUTOMATION: FABRIC • command-line tool for running remote shell commands
• fab deploy
QUESTIONS? @btriley yes, you could just use Heroku