Configuring Django Apps for Heroku
First, and most importantly, Heroku web applications require a Procfile.
This file is used to explicitly declare your application’s process types and entry points. It is located in the root of your repository.
Procfile.py --->
web: gunicorn myproject.wsgi
$ pip install gunicorn
$ pip install django-heroku
$ pip freeze > requirements.txt
import django_heroku
# Activate Django-Heroku.
django_heroku.settings(locals())
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
** PS: if Heroku isn't recognized as a command, please close your terminal and editor and then re-open it.
DEBUG = False # in settings.py
ALLOWED_HOSTS = ['your_app_name.herokuapp.com', 'localhost', '127.0.0.1'] # in settings.py
$ git init
$ git add .
$ git commit -m "first commit"
$ heroku login
$ heroku create app_name
$ heroku config:set DISABLE_COLLECTSTATIC=1
$ git push heroku master
$ heroku run python manage.py migrate
$ heroku run:detached python manage.py createsuperuser
$ heroku login
$ heroku git:remote -a app_name
$ git add .
$ git commit -am "make it better"
$ git push heroku master
heroku run python manage.py migrate