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).
🤘 Let's build the next big thing on Internet. Get started.
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
; in this case I used virtualenvwrapper, and all Python and pip packages are installed in a separated folder.
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
Start_gunicorn.sh is just a bash file to launch Django trough Gunicorn. Something like:
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.