Python on Heroku

less than 1 minute read

My notes on installing, running and using Python on Heroku

VirtualEnv

$ brew install python3
$ pip3 install virtualenv

$ mkdir project
$ cd project
$ virtualenv my_project

$ source my_project/bin/activate
$ deactivate

$ pip freeze > requirements.txt
$ pip install -r requirements.txt

References:

Flask-based REST/Web Application

  • add mLab MongoDB Free Sandbox

References:

Deploy

  • install heroku cli : brew install heroku
$ heroku login
...
$ heroku git:remote -a project-name-on-heroku
...
$ heroku config:set MONGO_URL=mongodb://...
...
$ git push heroku master

Categories: