heroku django deployment code example

Example 1: heroku django procfile

web: gunicorn myproject.wsgi

Example 2: heroku how to access config vars django

from boto.s3.connection import S3Connection
s3 = S3Connection(os.environ['S3_KEY'], os.environ['S3_SECRET'])

Example 3: how to deploy to heroku djangorest framework app

heroku login
You will prompt to provide heroku credentials(Email and password), once you have authenticated you can access both heroku and git commands.

Example 4: travis deployment script for django applications to heroku

language: python
deploy:
  provider: heroku
  buildpack: python
  api_key:
    secure: very_long_encrypted_token
  strategy: git
  app: glucosetracker-demo
  on:
    repo: jcalazan/glucose-tracker
  run:
    - "python glucosetracker/manage.py syncdb --noinput --settings=settings.heroku"
    - "python glucosetracker/manage.py migrate --all --settings=settings.heroku"
    - "python glucosetracker/manage.py load_random_glucose_data jsmith --settings=settings.heroku"
    - restart
script: "coverage run --source=. glucosetracker/manage.py test -v 2"