About this lesson
In this lesson, we'll continue to configuring our app for heroku by making more modifications, including: modifying Settings.py, adding Whitenoise Middleware, and creating the Requirements.text file.
Download this lesson’s related exercise files.Modify Settings.py add Whitenoise Middleware and Create Requirements.text file.docx
60.5 KB Modify Settings.py add Whitenoise Middleware and Create Requirements.text file - Solution.docx
Modify Settings.py add Whitenoise Middleware and Create Requirements.text file
After installing those Heroku-required libraries, we need to add them to our settings.py file.
When to use
Do this anytime you want to host your app on Heroku.
After pip installing each of the libraries mentioned, create a requirements.txt file at the terminal:
pip freeze > requirements.txt
Finally, add these lines to your settings.py file:
from decouple import config
MIDDLEWARE = [
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
Hints & tips
- pip freeze > requirements.txt
- Change your settings.py file to reflect the new libraries
Lesson notes are only available for subscribers.