mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Use ALLOWED_HOSTS for CSRF_TRUSTED_ORIGINS and Swagger URL
This commit is contained in:
@ -21,7 +21,6 @@ for setting in ['ALLOWED_HOSTS', 'DATABASE', 'SECRET_KEY']:
|
|||||||
|
|
||||||
# Default configurations
|
# Default configurations
|
||||||
ADMINS = getattr(configuration, 'ADMINS', [])
|
ADMINS = getattr(configuration, 'ADMINS', [])
|
||||||
CSRF_TRUSTED_ORIGINS = getattr(configuration, 'CSRF_TRUSTED_ORIGINS', [])
|
|
||||||
DEBUG = getattr(configuration, 'DEBUG', False)
|
DEBUG = getattr(configuration, 'DEBUG', False)
|
||||||
EMAIL = getattr(configuration, 'EMAIL', {})
|
EMAIL = getattr(configuration, 'EMAIL', {})
|
||||||
LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False)
|
LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False)
|
||||||
@ -30,6 +29,7 @@ PAGINATE_COUNT = getattr(configuration, 'PAGINATE_COUNT', 50)
|
|||||||
NETBOX_USERNAME = getattr(configuration, 'NETBOX_USERNAME', '')
|
NETBOX_USERNAME = getattr(configuration, 'NETBOX_USERNAME', '')
|
||||||
NETBOX_PASSWORD = getattr(configuration, 'NETBOX_PASSWORD', '')
|
NETBOX_PASSWORD = getattr(configuration, 'NETBOX_PASSWORD', '')
|
||||||
TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC')
|
TIME_ZONE = getattr(configuration, 'TIME_ZONE', 'UTC')
|
||||||
|
CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
@ -149,6 +149,12 @@ REST_FRAMEWORK = {
|
|||||||
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',)
|
'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Swagger settings (API docs)
|
||||||
|
SWAGGER_SETTINGS = {
|
||||||
|
'base_path': '{}/api/docs'.format(ALLOWED_HOSTS[0]),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
HOSTNAME = socket.gethostname()
|
HOSTNAME = socket.gethostname()
|
||||||
except:
|
except:
|
||||||
|
Reference in New Issue
Block a user