Django Heroku Deployment - Kitasio/MyWebDev GitHub Wiki
Deploy
In bash type heroku login
Install these packages:
django-heroku
, whitenoise
, and gunicorn
Whitenoise
Add this to settings.py in MIDDLEWARE 'whitenoise.middleware.WhiteNoiseMiddleware',
And this a the end of the file STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
requirements.txt
Best way to create it with this command:
pip freeze > requirements.txt
Procfile
Create Procfile
with this: web: gunicorn appname.wsgi
Add gitignore
Just create a file .gitignore
, go to google and find gitignore for django and paste it in your file
Pipenv
Make sure your Pipfile match the requirements.txt, in worst case you can just delete the Pipfile and Pipfile.lock and use pipenv install
, this command will create them from the requirements file