Skip to content

Instantly share code, notes, and snippets.

@ErnieAtLYD
Last active September 15, 2015 22:57
Show Gist options
  • Save ErnieAtLYD/bb2ba8b43f2f61652168 to your computer and use it in GitHub Desktop.
Save ErnieAtLYD/bb2ba8b43f2f61652168 to your computer and use it in GitHub Desktop.
The way I (total n00b) got my Flask App Working with Heroku

The way I (total n00b) got my Flask App Working with Heroku

  • Set up a github repo
  • Create a procfile
  • Make sure that gunicorn and all your requirements are in a requirements.txt file
$ pip install gunicorn
$ pip freeze > requirements.txt
  • Specify a Python version so that Heroku uses the right one to run our app by set runtime.txt for the version of python you're using
python-3.4.2
  • Push everything to github when you're ready
$ heroku create YOUR_PRODUCTION_APP
$ heroku create YOUR_STAGING_APP
$ git remote add pro [email protected]:YOUR_PRODUCTION_APP.git
$ git remote add stage [email protected]:YOUR_STAGING_APP.git

Databases

$ heroku addons:create heroku-postgresql:hobby-dev --app YOUR_STAGING_APP
  Adding heroku-postgresql:dev on wordcount-stage... done, v8 (free)
  Attached as HEROKU_POSTGRESQL_AMBER_URL
  Database has been created and is available
   ! This database is empty. If upgrading, you can transfer
   ! data from another database with pgbackups:restore.
  Use `heroku addons:docs heroku-postgresql:dev` to view documentation.
  
$ git push stage master
heroku run python manage.py db upgrade --app APP_NAME

Other resources that I've leeched out off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment