Skip to content
Leo Zhu edited this page Jun 29, 2013 · 6 revisions

Welcome to the flask_twip wiki!

Deploy flask_twip on Heroku

  1. Create a heroku project. Refer to Heroku's docs if you don't know how to.
  2. Copy files in https://github.com/yegle/flask_twip/tree/master/examples/heroku to your project directory.
  3. Copy the settings-example.py in https://github.com/yegle/flask_twip/tree/master/examples/ to your project directory, and rename it to settings.py.
  4. Edit the app.py change line 16 db=os.environ.get('HEROKU_POSTGRESQL_NAVY_URL'), to db=os.environ.get('DATABASE_URL'),.
  5. Add dev DB server to this project. Run heroku addons:add heroku-postgresql:dev in the root directory of your project.
  6. Push your porject to heroku, run git push heroku master.
  7. Init the database:
  8. Run heroku config | grep HEROKU_POSTGRESQL to get the config var name contain the URL used to access the database.
  9. Run heroku pg:promote HEROKU_POSTGRESQL_RED_URL to promote the varible of HEROKU_POSTGRESQL_RED_URL to DATABASE_URL, change HEROKU_POSTGRESQL_RED_URL with name you get in step 1.( maybe HEROKU_POSTGRESQL_SILVER_URL or whatever ) Go to https://devcenter.heroku.com/articles/heroku-postgresql#provisioning-the-addon to know more about Heroku Postgres.
  10. 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()
Clone this wiki locally