dockerizing-django
dockerizing-django copied to clipboard
Debug enabled in production
Hi,
I just noticed that, with the current setup, debug mode is enabled in production. More specifically:
https://github.com/realpython/dockerizing-django/blob/master/web/docker_django/settings.py#L26
should probably be something like DEBUG = True if os.getenv('DEBUG') == 'True' else False. I use this in my own setup and I prefer the default to be False to avoid accidentally enabling debug mode (e.g. if the setting is forgotten in .env).
I know this is only an example, but I think it's better to show people best practices :-)
Good point. Hopefully someone using this is advanced enough to know to already do that. Want to submit a PR?
I think it's good idea to check weather DEBUG should be enabled with environment variables. If nobody have done it I can grab this task.
yes. can you please grab it. thanks!
Thank you. Wow, I've delved into a code, and it's already done :) https://github.com/realpython/dockerizing-django/blob/master/web/docker_django/settings.py#L26 However how can we test this change?
Hi! I've looked into YAML spec and found there're lots of ways to set "True" value for a bool variable. So it's likely somebody'll want to use another legal variant, or try to change a case. So I've added parsing for such variants. And also a test to get sure variable is handled properly. This is a "lite" version of test - it mocks env vars and thus all checks are fast. PR: #38