Is there a way to determine if Django is running on localhost and setting the DEBUG
variable in settings.py
accordingly.
So that if I run the server locally it will set DEBUG
to True
and otherwise set it to False
.
Localhost: python manage.py runserver
Not localhost: python manage.py runserver 0.0.0.0:8000