Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug enabled in production #24

Open
dansondergaard opened this issue Apr 19, 2016 · 5 comments
Open

Debug enabled in production #24

dansondergaard opened this issue Apr 19, 2016 · 5 comments

Comments

@dansondergaard
Copy link
Contributor

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 :-)

@mjhea0
Copy link
Contributor

mjhea0 commented Apr 19, 2016

Good point. Hopefully someone using this is advanced enough to know to already do that. Want to submit a PR?

@lisitsky
Copy link
Contributor

lisitsky commented Nov 1, 2016

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.

@mjhea0
Copy link
Contributor

mjhea0 commented Nov 1, 2016

yes. can you please grab it. thanks!

@lisitsky
Copy link
Contributor

lisitsky commented Nov 1, 2016

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?

@lisitsky
Copy link
Contributor

lisitsky commented Nov 2, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants