Login in heroku:
heroku login
Add Procfile file:
web: gunicorn project.wsgi --log-file -; python manage.py collectstatic --noinput
Add cat runtime.txt:
python-2.7.13
Add to requirements:
dj_database_url==0.4.2 gunicorn==19.7.1 whitenoise==3.3.0
Add to settings.py file:
import dj_database_url # Heroku # Update database configuration with $DATABASE_URL. db_from_env = dj_database_url.config(conn_max_age=500) DATABASES['default'].update(db_from_env) DATABASES['default']['TEST'] = {'NAME': DATABASES['default']['NAME']} # Simplified static file serving. # https://warehouse.python.org/project/whitenoise/ STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' ]
Create PostgreSQL config:
heroku addons:create heroku-postgresql:hobby-dev
Set config:
heroku config:set DISABLE_COLLECTSTATIC=1 heroku config:set DEBUG_COLLECTSTATIC=1