Home > postgresql, python > Getting Started with Heroku – notes

Getting Started with Heroku – notes


1. Install the heroku cli.
2. If you have a preexisting git repository with the desired files to be pushed to heroku.
You need to have at minimum a Procfile and requirements.txt file

$ less Procfile
web: gunicorn wsgi:app
$ less requirements.txt

3. Merge changes into master branch if working off a different branch.
4. Login into heroku.
$ heroku login
5. Create a heroku app. You can specify a name for the app. Below command generate a random name.
$ heroku create
To create an app outside the default region of the us.
$ heroku create midnight-cask-76349 --region eu
6. Create a heroku postgres database.
$ heroku addons:create heroku-postgresql:hobby-dev
7. Push changes up to heroku app. Alembic changes get applied automatically on successful deploy.
$ git push heroku master
8. Set application `Config vars` under settings on the dashboard
9. Get database application details from dashboard. Follow link from database details under installed addons section. THe database url details will be available under the linked settings. Also have instructions on how to connect to database
$ heroku pg:psql postgresql-sparkle-97339 --app midnight-cask-76349
10. To manually run alembic
$ heroku run alembic upgrade head
11. To check logs
$ heroku logs --tail
12. To get database credentials
$ heroku pg:credentials:url
13. You can clone the heroku repo for the app locally
$ heroku git:clone -a midnight-cask-76349


Categories: postgresql, python Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: