SOLVED: Help needed! Flask App Deployment on Heroku

I figured out the issue. Below are some high level instruction for future reference in case anyone else is interested:

Heroku doesn’t work too well with SQLite (at least the way I had the project structured it seemed). So I created a PostgreSQL Database inside the Heroku application via the follow command:

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

With the new PostgreSQL database you’ll need a few dependent library so that it works with the SQLite database that is in the web application. More specifically you’ll need psycopg2, but before you get psycopg2 you’ll need a few other things as well.

sudo apt install gcc
sudo apt install libpq-dev
sudo apt install psycopg2

I would recommend you take a look at the documentation for full details on installing psycopg2 as it was a bit more involved for my system.

See details at https://www.psycopg.org/docs/install.html

Now you just need to update the requirement text file with the new packages, just run.

Update requirements:

(venv) $ pip freeze > requirements.txt

Finally set the flask app path to the run Heroku flask_app command.

$ heroku config:set FLASK_APP=flaskr
1 Like