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

Fix debug flag parsing, enable debug toolbar in docker #310

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Changes from all commits
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
11 changes: 9 additions & 2 deletions fm_eventmanager/settings.py.docker
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.getenv('DJANGO_DEBUG', False)
DEBUG = eval_bool(os.getenv('DJANGO_DEBUG', False))

LOGGING = {
'version': 1,
Expand Down Expand Up @@ -321,7 +321,14 @@ MAINTENANCE_MODE_IGNORE_URLS = ("^/u2f/",)
LOGIN_REDIRECT_URL = 'u2f:two-factor-settings'
LOGIN_URL = 'u2f:login'

INTERNAL_IPS = ['127.0.0.1']
if DEBUG:
# Adds docker NAT routers and any internal upstream proxies as internal IPs to enable the debug toolbar
import socket # only if you haven't already imported this
INTERNAL_IPS = ["127.0.0.1"]
for proxy_host in (socket.gethostname(), os.getenv("INTERNAL_PROXY_HOST")):
if proxy_host:
hostname, _, ips = socket.gethostbyname_ex(proxy_host)
INTERNAL_IPS += [ip[: ip.rfind(".")] + ".1" for ip in ips] + ips

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.9/howto/static-files/
Expand Down
Loading