Skip to content

Django 1.11 Heroku

Dan Loewenherz edited this page Oct 22, 2017 · 6 revisions

Features

Libraries

Includes a requirements.txt with libraries that promote Django best practices, such as:

  • Django storages, for support with many file storage backends.
  • Statictastic, for an easy way to sync static media to your storage backends.

Heroku Setup

  1. Create the project on Heroku or connect it to an existing project.

    heroku git:remote -a HEROKU-PROJECT-NAME
    

    Or:

    heroku apps:create HEROKU-PROJECT-NAME
    
  2. Add the PostgreSQL addon.

    heroku addons:create heroku-postgresql
    
  3. Specify that the project uses the Python buildpack.

    heroku buildpacks:set heroku/python
    
  4. Set the environment variables.

    heroku config:set APP_ENVIRONMENT=production
    heroku config:set AWS_ACCESS_KEY_ID=XXX
    heroku config:set AWS_SECRET_ACCESS_KEY=XXX
    heroku config:set AWS_STORAGE_BUCKET_NAME=XXX
    heroku config:set DISABLE_COLLECTSTATIC=1
    

Get started

To start a new Django project called project_name, run the following.

django-admin.py startproject -e md,ngx,ini,sh,Procfile.dev,Procfile --template=https://github.com/lionheart/django-template/archive/django-1.11-heroku.zip project_name
Clone this wiki locally