Disable DEBUG
When moving from development to production with your app, it is important to disable DEBUG mode.
Security
In Django, DEBUG = True in the settings.py
is intended for development.
This will be a definitie security risk and will display all kinds of sensitive details for attackers about your app such as, stack traces, environment variables, server paths, even API keys and code structure to name some.
Performance
Because Django is producing additional information by performing checks and providing loggin info, this could slow down the app.
DEBUG can be disabled in the settings.py
like so:
# settings.py
DEBUG = False # Ensure this is set to False in production for security
ALLOWED_HOSTS = ['yourdomain.com'] # Add your domain or IP here
If you don't want Django to throw an error with DEBUG = False
their needs to be a list of ALLOWED_HOSTS