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

Run by default without DEBUG to reduce memory load in production #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MikeTheCanuck
Copy link
Contributor

@@ -23,7 +23,7 @@
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get('DEBUG') == "True"
DEBUG = os.environ.get('DEBUG') == "False"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not what you want.

before the change:
If DEBUG is 'True' -> True
if DEBUG is 'False' -> False
if DEBUG is unset, or anything else -> False

After:
if DEBUG is "False", ("False" == "False" evaluates to True, so) Debug is True
if DEBUG is "True" ("True" == "False") -> False
anything else: False

I (personally) think a more clear approach would be:
DEBUG = bool(os.environ.get('DEBUG', False))
which takes the environment val DEBUG (or returns False if it's not set) and then casts it into a boolean value.

so 'True' -> True, and 'False' -> False.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn, yes that makes a lot more sense. I'll update.

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

Successfully merging this pull request may close these issues.

2 participants