Skip to content

Instantly share code, notes, and snippets.

@abhiomkar
Last active February 5, 2016 16:51
Show Gist options
  • Save abhiomkar/dd6502c9e0a15de3a487 to your computer and use it in GitHub Desktop.
Save abhiomkar/dd6502c9e0a15de3a487 to your computer and use it in GitHub Desktop.
Instructions to run censusreporter on Heroku

Clone Repo

git clone https://github.com/censusreporter/censusreporter.git
cd censusreporter

Install pip-save

source <(curl -sSLk https://raw.githubusercontent.com/abhiomkar/pip-save/master/install)

Install pip deps

pip install

Install gunicorn

pip --save install gunicorn

Add wsgi.py file for gunicorn

echo "from django.core.wsgi import get_wsgi_application" >> censusreporter/wsgi.py
echo "application = get_wsgi_application()" >> censusreporter/wsgi.py

set PYTHONPATH locally using these commands

add2virtualenv ./censusreporter
add2virtualenv ./censusreporter/apps

Edit postactive file to set django settings module environment automatically

cdvirtualenv bin
echo 'export DJANGO_SETTINGS_MODULE="config.dev.settings"' >> postactivate
echo 'echo "DJANGO_SETTINGS_MODULE set to $DJANGO_SETTINGS_MODULE"' >> postactivate

Re-enter your venv

deactivate
cd /path/to/censusreporter

Create Heroku App (replace census-reporter with unique name)

heroku create census-reporter

Create Procfile

echo "web: gunicorn censusreporter.wsgi --log-file -" > Procfile

Deploy to Heroku

git add .
git commit -am "Preparing App for Heroku deployment"
git push heroku master

Config Heroku App

heroku config:add DJANGO_SETTINGS_MODULE=config.dev.settings
heroku config:set PYTHONPATH=./censusreporter:./censusreporter/apps

Phew! Run your app now

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