GeniePy supports deployments to Heroku.

The following sections assume that the heroku CLI is installed on your machine and that it's logged in to your Heroku account. Please follow Heroku's setup instructions if this is not already the case.

1. Create application

The first step is to create an application:

$ heroku apps:create geniepy
Creating ⬢ geniepy... done |

Next, we need to tell Heroku that this app is using containers.

$ heroku stack:set container

2. Set environment variables

Next, we need to set the essential environment variables using heroku config:set. These are the variables without which the app cannot function.

$ heroku config:set \
    SITE_NAME=Name \ \
    SITE_URL= \
    COOKIE_SECRET=s3cr3t \
    CSRF_SECRET=s3cr3t \

3. Initialize PostgreSQL

PostgreSQL is available on Heroku as an addon. Let's provision one using the CLI.

In this example we will use the "hobby-dev" plan which does not cost anything. For real-world deployments, please consider using a different plan geared more towards production usage.

$ heroku addons:create heroku-postgresql:hobby-dev

This will provision the database and export the connection string as the DATABASE_URL environment variable to our app.

Now that the app knows how to access the database, let's run database migrations to bring it into the latest state.

$ heroku run alembic -c app/alembic.ini upgrade head

4. All done!

That should be it! You can now access your app in the browser using:

$ heroku open