Skip to content

Instantly share code, notes, and snippets.

@aleksb86
Created January 8, 2019 21:40
Show Gist options
  • Save aleksb86/94835c4cc941339c077f1c0a1c251217 to your computer and use it in GitHub Desktop.
Save aleksb86/94835c4cc941339c077f1c0a1c251217 to your computer and use it in GitHub Desktop.
GIT Deploying Django (DRF) project to Heroku

Before you start - use virtualenv for isolated Python environment. This manual cant apply to Django project with static files (JS, CSS, images etc.) 0. You should to register to heroku.com

  1. Install Heroku CLI: curl https://cli-assets.heroku.com/install-ubuntu.sh | sh or quick install: curl https://cli-assets.heroku.com/install.sh | sh
  2. Create Django-rest-framework project, init git repository.
  3. $ heroku login
  4. $ heroku create [preferred_name_of_application]
  5. Create file runtime.txt (on same level that Django project directory and application directory) with content: python-3.6.7
  6. Create file Procfile (on same level that Django project directory and application directory) with content: web: gunicorn <name_of_django_project>.wsgi --log-file -
  7. $ pip install gunicorn
  8. To be continue.... (see instruction https://www.youtube.com/watch?v=xnB0G1WxctM)
  9. Set ALLOWED_HOSTS in settings.py (i.e. ALLOWED_HOSTS = ['*'] # - for allow all)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment