Skip to content

Instantly share code, notes, and snippets.

@fduran
Created February 20, 2012 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fduran/1870536 to your computer and use it in GitHub Desktop.
Save fduran/1870536 to your computer and use it in GitHub Desktop.
Heroku Python
# www.fduran.com
# Heroku notes for python, fixes http://devcenter.heroku.com/articles/python
# Ubuntu 11.04 (Natty Narwhal)
mkdir heroku
cd heroku
# Prerequisites
curl -O https://raw.github.com/pypa/virtualenv/master/virtualenv.py
cp virtualenv.py /usr/bin/virtualenv
chmod a+x /usr/bin/virtualenv
# for Flask example: pip install Flask
# Local Workstation Setup
# apt-add-repository doesn't work
echo "deb http://toolbelt.herokuapp.com/ubuntu ./" >> /etc/apt/sources.list
curl http://toolbelt.herokuapp.com/apt/release.key | apt-key add -
apt-get update
apt-get install heroku-toolbelt
# note: they say so but that does not install foreman
ln -s /usr/bin/ruby1.8 /usr/bin/ruby
heroku login
nano web.py
# Declare Dependencies with Pip
nano requirements.txt
# note: after first deployment it change magically to wsgiref==0.1.2, back to Flask
pip freeze > requirements.txt
# rest the same
# Foreman
apt-get install rubygems
gem install foreman
ln -s /var/lib/gems/1.8/bin/foreman /usr/bin/foreman
# rest the same
# pushing changed code
git add . # for new files
git commit -am "balh"
git push heroku master
# django
# pre-requisite before pip install Django psycopg2
apt-get install libpq-dev python-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment