Skip to content

Instantly share code, notes, and snippets.

@liyi54
Created September 9, 2020 02:38
Show Gist options
  • Save liyi54/e67e8e985cf44650c41d98337ee674ed to your computer and use it in GitHub Desktop.
Save liyi54/e67e8e985cf44650c41d98337ee674ed to your computer and use it in GitHub Desktop.
Django App Heroku Deployment

Django app Heroku Deployment

Steps to deploying a Django app to Heroku

Install guinicorn locally

pipenv install gunicorn
or
pip install gunicorn

Install Heroku CLI

https://devcenter.heroku.com/articles/heroku-cli

Login via CLI

heroku login

Create app

heroku create 

Set Remote repository

heroku git:remote -a <app-name>

Create Procfile

touch Procfile

# Add this
web: gunicorn <app-name>.wsgi

Install whitenoise to serve static files

pip install whitenoise

Create requirements.txt

pip freeze > requirements.txt

Run the project locally using the gunicorn server

heroku local

Deploy with Git

git init
git add . && git commit -m 'Deploy'
git push heroku master

Visit app

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