Skip to content

Commit

Permalink
settings: Move INTERNAL_IPS config to top level
Browse files Browse the repository at this point in the history
When running in debug mode, it is necessary to have the INTERNAL_IPS variable
properly set in order to have some functionality.

Before we were assuming that it was only necessary for the Django toolbar,
however, according the documentation [1] it is also necessary for exposing some
variables in the template context, which is something we are going to need in
the future.

1: https://docs.djangoproject.com/en/3.2/ref/settings/#internal-ips
  • Loading branch information
vincent-olivert-riera committed Nov 2, 2023
1 parent 6414d44 commit e264426
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion promgen/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG", default=False)

if DEBUG:
INTERNAL_IPS = ["127.0.0.1"]

# Settings for Prometheus paths and such
if PROMGEN_CONFIG_FILE.exists():
with PROMGEN_CONFIG_FILE.open() as fp:
Expand Down Expand Up @@ -210,7 +213,6 @@
import debug_toolbar # NOQA

INSTALLED_APPS += ["debug_toolbar"]
INTERNAL_IPS = ["127.0.0.1"]
except ImportError:
MIDDLEWARE.remove("debug_toolbar.middleware.DebugToolbarMiddleware")

Expand Down

0 comments on commit e264426

Please sign in to comment.