Download Heroku Toolbelt.
Navigate to the root of the sources of your Django app. You'll need tk
Type heroku create [app_name]
. If you don't give an app name, Heroku will randomly generate one for you. Your app URL will be http://[app name].herokuapp.com
Make a text file with the name Procfile
. Don't put an extension at the end.
web: <bash command to start production server>
If you have a worker process, you can add it too. Add another line in the format:
worker-name: <bash command to start worker>
Add a requirements.txt.
pip freeze > requirements.txt
It's deployment time!
git push heroku master
Heroku needs a git repository or a dropbox folder to do deploys. You can alternatively set up automatic reloading from a GitHub repository at
heroku.com
, but we won't cover that in this tutorial.
heroku ps:scale web=1
This scales the number of web "dynos" to one. You can learn more about dynos here.
heroku open
or navigate to http://app-name.herokuapp.com
Tip:
heroku open
opens the URL to your heroku app in the default browser.
Add add-ons. You'll need to configure your Django app to bind with databases provided in Heroku as "add-ons". This example doesn't cover this, but another example is in the pipeline on deploying databases in Heroku.