Skip to content

Latest commit

 

History

History
executable file
·
71 lines (45 loc) · 1.32 KB

README.md

File metadata and controls

executable file
·
71 lines (45 loc) · 1.32 KB

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)