Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Cookiecutter template for Django deployment on AWS Elastic Beanstalk (EB)

This cookiecutter template is for you whom might want to get a Django app running on AWS Elastic Beanstalk.

The template let you choose if you want to use a AWS EB Docker deployment or Python deployment.

What you get

  • with instructions that will get you started to deploy your django app on AWS EB
  • A working local environment
  • Dockerfile (in both Python and Docker version)

Should I choose Python or Docker deployment?

For simplicity you should choose Python deployment, as it is supported. However, there are some problems with the way how the Python deployment option is configured, such as /static/ is always mapped in their Apache configuration to a path, that needs a workaround for Whitenoise to work. Take a look at this post at Stackoverflow.

The Docker deployment gives you more flexibility, such as you might wanna add something else that runs in the Docker container. And you can get a quite nice local Docker to AWS EB deployment parity. Meaning, if it works in the Docker container, you most probably have it working in deployment. The EB CLI gives you possibility to try out the deployment locally.

What is next after using this cookiecutter?

Take a look at the generated for information how to deploy up your django app on AWS Elastic Beanstalk.

Template variables

  • aws_eb_type: if you want EB python or docker setup
  • project_name: django project name, just like in startproject
  • django_version: what django version to install
  • setup_local_env: if we should keep the virtualenvironment with requirements/local.txt installed and create postgres database
  • virtualenv_bin: location to virtualbin binary, in case it is not in your path, or if you wanna use some other virtualenv binary
  • source_root: relative location where the source code should end up, default is ".". Example use src to get all the django code to reside in src/ directory.


Windows users, sorry, don't think this will work for you :) Pull requests for Windows support are welcome! :)


# cookiecutter

The hooks

You should take a look at the hooks, so you know that it will not do anything harmful. If you think it does something harmful, please create a ticket!


The pre-generation hook will create a virtualenvironment in .ve and then install the specific django version inside of the virtualenvironment. Then it will run startproject project_name ..

It will also assure that you have virtualenv available on your path. If setup_local_env=yes then it will also assure that createdb is on your path.

In case aws_eb_type!=docker, the file will be deleted.


The post-generation hook will:

  • Rename/move <project_name>/ to <project_name>/settings/
  • Patch and to have <project_name>.settings.local as default DJANGO_SETTINGS_MODULE.
  • Patch <project_name>/settings/ and <project_name>/ to have Whitenoise by default

If setup_local_env=yes then the post-generation hook will:

  • Attempt to create the postgres database <project_name>
  • Install requirements/local.txt into the virtualenv

If setup_local_env!=yes then the post-generation hook will:

  • Remove the .ve directory


Cookiecutter template for Django deployment on AWS Elastic Beanstalk (EB)




No releases published


No packages published