aboutsummaryrefslogtreecommitdiff
path: root/rpki/django_settings.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-09-16 04:53:49 +0000
committerRob Austein <sra@hactrn.net>2014-09-16 04:53:49 +0000
commit238c447318617fc42b38a0396ef9b05022ccfd90 (patch)
tree350bd25e9ea892fa79bb5bdec0f41158fa5ba8f3 /rpki/django_settings.py
parent558a82a19f6771ea264a9d7c56ec089b31643af1 (diff)
Add support for running GUI under yamltest.
Result sometimes hangs with browser waiting for response, not sure why, might be ancient abandoned bug #116. Logging control is a bit screwy, everything uses Python's logging library but we have multiple ways of configuring it. svn path=/branches/tk713/; revision=5954
Diffstat (limited to 'rpki/django_settings.py')
-rw-r--r--rpki/django_settings.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/rpki/django_settings.py b/rpki/django_settings.py
index eb3a184b..d3cadcfc 100644
--- a/rpki/django_settings.py
+++ b/rpki/django_settings.py
@@ -37,15 +37,20 @@ cfg = rpki.config.parser()
# Do -not- turn on DEBUG here except for short-lived tests, otherwise
# long-running programs like irdbd will eventually run out of memory
-# and crash.
+# and crash. This is also why this is controlled by an environment
+# variable rather than by an rpki.conf setting: just because we want
+# debugging enabled in the GUI doesn't mean we want it in irdb.
#
-# If you must enable debugging, use django.db.reset_queries() to
-# clear the query list manually, but it's probably better just to
-# run with debugging disabled, since that's the expectation for
-# production code.
+# If you must enable debugging, you may need to add code that uses
+# django.db.reset_queries() to clear the query list manually, but it's
+# probably better just to run with debugging disabled, since that's
+# the expectation for production code.
#
# https://docs.djangoproject.com/en/dev/faq/models/#why-is-django-leaking-memory
+if os.getenv("RPKI_DJANGO_DEBUG") == "yes":
+ DEBUG = True
+
# Database configuration. This is always enabled, and uses a database
# "router" to handle multiple databases. We may want to add yet
@@ -171,6 +176,8 @@ if os.getenv("RPKI_GUI_ENABLE") == "yes":
def get_allowed_hosts():
allowed_hosts = set(cfg.multiget("allowed-hosts", section = "web_portal"))
allowed_hosts.add(socket.getfqdn())
+ allowed_hosts.add("127.0.0.1")
+ allowed_hosts.add("::1")
try:
import netifaces
for interface in netifaces.interfaces():