Support to move the horizon relative to web root

When deploying Horizon, on a web server, where other applications
are used, it's quite handy to be able to move Horizon around quickly.
This change introduces a single Variable WEBROOT to achieve this.

Implements: blueprint shared-webserver

Change-Id: Ic731f6754e233b328a8dbe7026b1d7417620fd66
This commit is contained in:
Matthias Runge 2014-04-11 13:50:34 +02:00
parent c9172c578d
commit 2a772d6480
3 changed files with 53 additions and 14 deletions

View File

@ -822,6 +822,19 @@ Disable SSL certificate checks in the OpenStack clients (useful for self-signed
certificates).
``OPENSTACK_TOKEN_HASH_ALGORITHM``
----------------------------------
.. versionadded:: 2014.2(Juno)
Default: ``"md5"``
The hash algorithm to use for authentication tokens. This must match the hash
algorithm that the identity (Keystone) server and the auth_token middleware
are using. Allowed values are the algorithms supported by Python's hashlib
library.
``POLICY_FILES``
----------------
@ -877,17 +890,21 @@ To disable these extensions set the permission to something
unusable such as ``[!]``.
``OPENSTACK_TOKEN_HASH_ALGORITHM``
----------------------------------
``WEBROOT``
-----------
.. versionadded:: 2015.1(Kilo)
Default: ``"/"``
Specifies the location where the access to the dashboard is configured in
the web server.
E.g. if you're accessing the Dashboard via https://<your server>/horizon, you'd
set this to ``"/horizon"``.
.. versionadded:: 2014.2(Juno)
Default: ``"md5"``
The hash algorithm to use for authentication tokens. This must match the hash
algorithm that the identity (Keystone) server and the auth_token middleware
are using. Allowed values are the algorithms supported by Python's hashlib
library.
Django Settings (Partial)
=========================

View File

@ -7,6 +7,19 @@ from openstack_dashboard import exceptions
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# WEBROOT is the location relative to Webserver root
# should end with a slash.
WEBROOT = '/'
# LOGIN_URL = WEBROOT + 'auth/login/'
# LOGOUT_URL = WEBROOT + 'auth/logout/'
#
# LOGIN_REDIRECT_URL can be used as an alternative for
# HORIZON_CONFIG.user_home, if user_home is not set.
# Do not set it to '/home/', as this will cause circular redirect loop
# LOGIN_REDIRECT_URL = WEBROOT
# Required for Django 1.5.
# If horizon is running in production (DEBUG is False), set this
# with the list of host/domain names that the application can serve.

View File

@ -41,12 +41,11 @@ TEMPLATE_DEBUG = DEBUG
SITE_BRANDING = 'OpenStack Dashboard'
LOGIN_URL = '/auth/login/'
LOGOUT_URL = '/auth/logout/'
# LOGIN_REDIRECT_URL can be used as an alternative for
# HORIZON_CONFIG.user_home, if user_home is not set.
# Do not set it to '/home/', as this will cause circular redirect loop
LOGIN_REDIRECT_URL = '/'
WEBROOT = '/'
LOGIN_URL = None
LOGOUT_URL = None
LOGIN_REDIRECT_URL = None
MEDIA_ROOT = os.path.abspath(os.path.join(ROOT_PATH, '..', 'media'))
MEDIA_URL = '/media/'
@ -257,6 +256,16 @@ try:
except ImportError:
logging.warning("No local_settings file found.")
if not WEBROOT.endswith('/'):
WEBROOT += '/'
if LOGIN_URL is None:
LOGIN_URL = WEBROOT + 'auth/login/'
if LOGOUT_URL is None:
LOGOUT_URL = WEBROOT + 'auth/logout/'
if LOGIN_REDIRECT_URL is None:
LOGIN_REDIRECT_URL = WEBROOT
# Load the pluggable dashboard settings
import openstack_dashboard.enabled
import openstack_dashboard.local.enabled