You will need to install Docker first.

Before building the image make sure you have all of the front-end assets prepared for production:

$ npm run build-assets --production
$ python collectstatic

Then use Docker to build the image:

$ docker build -t mystorefront .


First steps

$ heroku create --buildpack
$ heroku buildpacks:add
$ heroku addons:create heroku-postgresql:hobby-dev
$ heroku addons:create heroku-redis:hobby-dev
$ heroku addons:create sendgrid:starter
$ heroku addons:create bonsai:sandbox-6
$ heroku config:set ALLOWED_HOSTS='<your hosts here>'
$ heroku config:set NODE_MODULES_CACHE=false
$ heroku config:set NPM_CONFIG_PRODUCTION=false
$ heroku config:set SECRET_KEY='<your secret key here>'


Heroku’s storage is volatile. This means that all instances of your application will have separate disks and will lose all changes made to the local disk each time the application is restarted. The best approach is to use cloud storage such as Amazon S3. See Static file and media storage using Amazon S3 for configuration details.


$ git push heroku master

Prepare the database

$ heroku run python migrate

Updating currency exchange rates

This needs to be run periodically. The best way to achieve this is using Heroku’s Scheduler service. Let’s add it to our application:

$ heroku addons:create scheduler

Then log into your Heroku account, find the Heroku Scheduler addon in the active addon list, and have it run the following command on a daily basis:

python update_exchange_rates --all