How we are deploying Django projects to AWS
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 the stack. Let's go!
AWS:
I personally prefer Google Cloud Platform. Probably I will write about that on this blog soon.
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.
This is just a step. There are a lot way to do it. Here the stack. Let's go!
AWS:
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.
I'm clonning the Git repo under /home/ubuntu by using the ubuntu user.
Virtualenvwrapper:
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:
Gunicorn is just an HTTP server for Python projects.
I have started my Django project on server trough Gunicorn on a local hostname and port (http://localhost:8000).
Supervisor:
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
Start_gunicorn.sh is just a bash file to launch Django trough Gunicorn. Something like:
Nginx:
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 mydomain.com.
Nginx is also serving all the Django static files, and make it visible from /static.
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.