Getting Started with Python, Flask, SQLAlchemy, JSON, JQuery, and Heroku
Run Locally
-
Setup virtualenv
-
Setup PostgreSQL
Set the
DATABASE_URLenvironment variable to point to your PostgreSQL server:export DATABASE_URL=postgres://foo:foo@localhost/helloherokuCreate the database schema:
python manage.py createDbSchema -
Start Flask Server
-
Test out the app
Run on Heroku
-
Create the app
-
Add the Heroku Shared Database Add-on
heroku addons:add shared-database -
Deploy the app
-
Create the database schema
heroku run "python manage.py createDbSchema" -
Open the app in your browser
-
Verify that it works
-
Switch the app to
PRODmodeheroku config:add PROD=True