From e23a785a14f1bcb3194f86cc45e9d9f7b71ad91e Mon Sep 17 00:00:00 2001 From: Logan V Date: Thu, 15 Mar 2018 13:20:14 -0500 Subject: [PATCH] Use relative paths Relative paths are helpful when running netbox behind a load balancer where the client's path may not match what the server receives. BASE_PATH can still be used to mimic the current behavior by setting: BASE_PATH = '/' --- netbox/netbox/settings.py | 6 +++--- netbox/templates/_base.html | 2 +- netbox/templates/rest_framework/api.html | 2 +- netbox/utilities/forms.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index c531231b1..849ed6d45 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -195,13 +195,13 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) STATIC_ROOT = BASE_DIR + '/static/' -STATIC_URL = '/{}static/'.format(BASE_PATH) +STATIC_URL = '{}static/'.format(BASE_PATH) STATICFILES_DIRS = ( os.path.join(BASE_DIR, "project-static"), ) # Media -MEDIA_URL = '/{}media/'.format(BASE_PATH) +MEDIA_URL = '{}media/'.format(BASE_PATH) # Disable default limit of 1000 fields per request. Needed for bulk deletion of objects. (Added in Django 1.10.) DATA_UPLOAD_MAX_NUMBER_FIELDS = None @@ -212,7 +212,7 @@ MESSAGE_TAGS = { } # Authentication URLs -LOGIN_URL = '/{}login/'.format(BASE_PATH) +LOGIN_URL = '{}login/'.format(BASE_PATH) # Secrets SECRETS_MIN_PUBKEY_SIZE = 2048 diff --git a/netbox/templates/_base.html b/netbox/templates/_base.html index f34c0fbde..e4ec7382d 100644 --- a/netbox/templates/_base.html +++ b/netbox/templates/_base.html @@ -67,7 +67,7 @@