Explore our extensive collection of courses designed to help you master various subjects and skills. Whether you're a beginner or an advanced learner, there's something here for everyone.


Learn live

Join us for our free workshops, webinars, and other events to learn more about our programs and get started on your journey to becoming a developer.

Upcoming live events

Learning library

For all the self-taught geeks out there, here is our content library with most of the learning materials we have produced throughout the years.

It makes sense to start learning by reading and watching videos about fundamentals and how things work.

Search from all Lessons

LoginGet Started
← Back to Lessons
  • flask

  • node

  • reactjs

Edit on Github

Deploy to Heroku with Postgresql

Get ready

Deploy to Heroku, it takes 7 minutes.

Our templates are% compatible with Heroku, just make sure to understand and execute the following steps.

Get ready

  1. Create an account on, do not create a project, you will do that later, all you need is email and password set.

  2. Install Heroku (if you don't have it yet)

1npm i heroku -g
  1. Login to Heroku on the command line (if you have not already)
1heroku login -i
  1. Create an application (if you don't have it already)
1heroku create <your_application_name>
  1. Install buildpack-registry and buildpacks
1heroku plugins:install buildpack-registry 2heroku plugins:install buildpacks
  1. Add Python and also node.js capabilities to Heroku to be able to use npm on production
1heroku buildpacks:add --index 1 heroku/python 2heroku buildpacks:add --index 2 heroku/nodejs
  1. Add a new Postgres database to your project
1$ heroku addons:create heroku-postgresql:hobby-dev 2# this command will also automatically add a DATABASE_URL env variable with the Postgres database url
  1. Other Environment Variables

You cannot create a .env file on Heroku, instead you need to manually add all the variables using the command line or under your Heroku dashboard project settings.

Open your .env file and copy and paste each variable (FLASK_APP, FLASK_ENV, etc.) to Heroku. ⚠️ Do not add the DATABASE_URL variable again, it was already added by Heroku automatically when we added the Postgres add-on.

1$ heroku config:set FLASK_APP_KEY="any key works" 2$ heroku config:set FLASK_APP=src/ 3# ↓ Important: Set to "production" 4$ heroku config:set FLASK_ENV=production 5$ heroku config:set BASENAME=/ 6$ heroku config:set BACKEND_URL=

Configuring Env Variables

Push your changes

The last step is to push your code to Heroku with your most recent changes:

1git add . 2git commit -m 'deploying to heroku' 3git push heroku main


That is it! If you encounter any issues please refer to the FAQ Heroku file.