Skip to content

Easily edit and deploy a Flask based app with sqlalchemy and postgresql on Heroku with this boilerplate

License

Notifications You must be signed in to change notification settings

gmolveau/flask-sqlalchemy-heroku

Repository files navigation

Flask + SQLAlchemy + Heroku

A boilerplate for a flask based app with sqlalchemy and postgresql -> deploy easily on heroku

Deploy

Getting started

Install the app

$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install -r requirements.txt

Dev mode

Copy the .env.example to .env.

The default URL for the database should work by default.

Run the database + adminer :

docker-compose -f docker-compose.dev.yml up -d

Reset the database :

flask reset_db

Explore the database :

  • go to http://localhost:8123
    • System = Postgresql
    • Server = db # name of the service in the docker-compose
    • Username =
    • Password =
    • Database = <database_name>

Launch the app

FLASK_ENV=development flask run

Try to visit http://localhost:5000/api/v1/

Heroku

https://devcenter.heroku.com/articles/getting-started-with-python

Run locally

# with the heroku toolbelt installed : https://devcenter.heroku.com/articles/heroku-cli
heroku local

Task scheduling

Schedule a task for free every 10 minutes, every hour, or every day with heroku-scheduler :

Scheduler

Todo

  • Use flask-migrate (alembic)

About

Easily edit and deploy a Flask based app with sqlalchemy and postgresql on Heroku with this boilerplate

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published