Deploying Django apps on Heroku

By : Shabda Raaj

Read this first:

This is a great article by the Heroku. I am just filling in some more details and making this step-by-step.

  1. Get your Django project code.

  2. Create a virtualenv with a no-site-packages command

    virtualenv vent --no-site-packages
  3. Install Django, psycopg2 (postgres connector), gunicorn and any other required Django libraries.

  4. Confirm that you have all the required libraries and you can run your code locally using runserver.

  5. Create a requirement.txt by using
    pip freeze > requirements.txt
  6. Make sure you have a requirements.txt at the root of your repo. Heroku uses this to identify that the app is a Python app.

  7. Create a Procfile. Put this entry:

    web: python mysite/ run_gunicorn -b "$PORT" -w 3shabda
  8. This is what your directory structure will look like

  9. (If you aren't tracking your files with git yet.) Track your files with git.

    git init
    git add .
    git commit -am "First commit"
  10. Make sure you have the heroku toolbelt installed. If not go to and install.

11.You should have these commands available now:

  1. Authenticate to heroku with

    heroku auth:login
  2. Run this command.

    heroku create --stack cedar

This will create a new Heroku app and create a new remote in your git repo.

  1. Push your code to heroku.

    git push heroku master
  2. Your app should be working on Heroku now. heroku open will show your site.

Related Posts

Can we help you build amazing apps? Contact us today.

Topics : django


Latest Price

Hi and first of all thanks to you for your sharing this great info – I have definitely picked up anything new from right here. I did however expertise several technical points using your blog, as I experienced to reload the web site very slow and some time it takes a lot of time. This is my friendly suggestion to you to change your service provider as I have also open to and ots really fast as compare to your service provider, Anyway I’m adding this RSS to my e-mail and could look out for a lot more of your respective fascinating content. Ensure that you update this again very soon.

© Agiliq, 2009-2012