Internally, we are constantly looking for the best way to deploy some Django projects to AWS.  Some people prefer to use automated process (yeah! automated deploys).

This is just a step. There are a lot way to do it. Here is the stack. Let’s go!

I personally prefer Google Cloud Platform. Probably I will write about that on this blog soon.

I’m using a EC2 instance, with Ubuntu.
I’m clonning the  Git repo under  /home/ubuntu by using the ubuntu user.


Virtual environment is an important requirement. I have used both virtualenv  and virtualenvwrapper; in this case I used virtualenvwrapper, and all Python and pip packages are installed in a separated folder.


Gunicorn is just an HTTP server for


I have started my Django project on server trough Gunicorn on a local hostname and port (http://localhost:8000).


I use Supervisor to convert my project in a daemon. That’s it. So, if I restart the server, this daemon will be started automatically.

This is my  /etc/supervisor/conf.d/myproject.conf

stdout_logfile_maxbyes=20MB  is just a bash file to launch Django trough Gunicorn. Something like:

gunicorn myproject.wsgi:application -w 3 --bind= 


Nginx is very cool HTTP/Proxy server. I’m using Nginx as a proxy, to serve the local project to the web.

I’ts like make enabled  localhost:8000  from 


Nginx is also serving all the Django static files, and make it visible from  /static.

server {
listen 80;
client_max_body_size 5M;
charset utf8;
keepalive_timeout 6;

access_log /home/ubuntu/logs/nginx.access.log;
error_log /home/ubuntu/logs/nginx.error.log;

location / {
proxy_read_timeout 800;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;

location /static {
alias /home/ubuntu/myproject/static;
autoindex on;

If you need help with your deployment or managing your stack, please contact us.

Have any questions? Have a better way?  Please post it below.

Join 8500+ CEOs and CTOs globally!

Receive exclusive tips and resources on how to build and grow your business by 200%.