Get a new django app up and running in in Elastic beanstalk in under 5 minutes
A starter template to get you up and running django app that works out of box with AWS Elastic Beanstalk.
The template contains following settings:
- Default settings for Project root, static root.
- Separate Development, Testing and Production settings for seamless deployment
- Celery fully configured to run in Elastic beanstalk app
- Automatic Db migrations when deploying.
Prerequisites
On your local machine, you should have folloing configured:
- Postgres DB
- Rabbit MQ Broker
- AWS CLI installed and configured.
To complete prerequisites, refer this tutorial.
Steps
- In your project folder, clone contents of this repo with:
$ git clone git@github.com:CodePalTutorials/django-elasticbeanstalk-starter.git .
- Init python virtual environement and install requirements.
$ virtualenv venv
$ pip install -r < requirements.txt
-
Add local database settings in
ebdjango/local_settings.py
. -
Create elastic beanstalk app and provision a postgres database with that app.
$ eb init -p python2.7 <appname>
$ eb init
$ eb create production-env
For more details on how, rerfer Step 6 of this tutorial.
- Set correct environment variables in Elastic beanstalk environment. For ex, to make current environment production environment, set:
$ eb setenv ENVIRONMENT=PROD
Options are PROD
, TEST
and DEVEL
..
-
Set your rabbit MQ broker URL in
ebdjango/testing_settings.py
&ebdjango/production_settings.py
. -
Deploy with
eb deploy
.
Refer to the tutorial below if you need more help with setting things up: https://codepal.herokuapp.com/deploying-django-app-on-aws-using-elastic-beanstalk/) tutorial.
- Creating & Deploying basic Django app on Elasticbeasntalk: https://codepal.herokuapp.com/deploying-django-app-on-aws-using-elastic-beanstalk.
- Adding celery on Django Elastic beanstalk app: [WIP]
Any suggestions and contribution and welcome. Feel free to send PR and raise issues.