forked from twip/flask_twip
-
Notifications
You must be signed in to change notification settings - Fork 4
Home
Leo Zhu edited this page Jun 29, 2013
·
6 revisions
Welcome to the flask_twip wiki!
- Create a heroku project. Refer to Heroku's docs if you don't know how to.
- Copy files in https://github.com/yegle/flask_twip/tree/master/examples/heroku to your project directory.
- Copy the
settings-example.py
in https://github.com/yegle/flask_twip/tree/master/examples/ to your project directory, and rename it tosettings.py
. - Edit the
app.py
change line 16db=os.environ.get('HEROKU_POSTGRESQL_NAVY_URL'),
todb=os.environ.get('DATABASE_URL'),
. - Add dev DB server to this project. Run
heroku addons:add heroku-postgresql:dev
in the root directory of your project. - Push your porject to heroku, run
git push heroku master
. - Init the database:
- Run
heroku config | grep HEROKU_POSTGRESQL
to get the config var name contain the URL used to access the database. - Run
heroku pg:promote HEROKU_POSTGRESQL_RED_URL
to promote the varible ofHEROKU_POSTGRESQL_RED_URL
toDATABASE_URL
, changeHEROKU_POSTGRESQL_RED_URL
with name you get in step 1.( maybeHEROKU_POSTGRESQL_SILVER_URL
or whatever ) Go to https://devcenter.heroku.com/articles/heroku-postgresql#provisioning-the-addon to know more about Heroku Postgres. - Run
heroku run python
and type the following Python code:
import os
from flask.ext.twip.backend import SQLBackend
be = SQLBackend(db=os.environ.get('DATABASE_URL'),table='twip_tokens')
be.init_db()