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
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion neighborhoods_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.


ALLOWED_HOSTS = ['*']

Expand Down