mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
#212: Introduced BASE_PATH configuration setting
This commit is contained in:
parent
5b7f350ded
commit
833499ffe8
@ -26,6 +26,18 @@ BANNER_BOTTOM = BANNER_TOP
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## BASE_PATH
|
||||||
|
|
||||||
|
Default: None
|
||||||
|
|
||||||
|
The base URL path to use when accessing NetBox. Do not include the scheme or domain name. For example, if installed at http://example.com/netbox/, set:
|
||||||
|
|
||||||
|
```
|
||||||
|
BASE_PATH = 'netbox/'
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## DEBUG
|
## DEBUG
|
||||||
|
|
||||||
Default: False
|
Default: False
|
||||||
|
@ -52,6 +52,10 @@ EMAIL = {
|
|||||||
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
||||||
LOGIN_REQUIRED = os.environ.get('LOGIN_REQUIRED', False)
|
LOGIN_REQUIRED = os.environ.get('LOGIN_REQUIRED', False)
|
||||||
|
|
||||||
|
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
|
||||||
|
# BASE_PATH = 'netbox/'
|
||||||
|
BASE_PATH = os.environ.get('BASE_PATH', '')
|
||||||
|
|
||||||
# Setting this to True will display a "maintenance mode" banner at the top of every page.
|
# Setting this to True will display a "maintenance mode" banner at the top of every page.
|
||||||
MAINTENANCE_MODE = os.environ.get('MAINTENANCE_MODE', False)
|
MAINTENANCE_MODE = os.environ.get('MAINTENANCE_MODE', False)
|
||||||
|
|
||||||
|
@ -52,6 +52,10 @@ EMAIL = {
|
|||||||
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
# are permitted to access most data in NetBox (excluding secrets) but not make any changes.
|
||||||
LOGIN_REQUIRED = False
|
LOGIN_REQUIRED = False
|
||||||
|
|
||||||
|
# Base URL path if accessing NetBox within a directory. For example, if installed at http://example.com/netbox/, set:
|
||||||
|
# BASE_PATH = 'netbox/'
|
||||||
|
BASE_PATH = ''
|
||||||
|
|
||||||
# Setting this to True will display a "maintenance mode" banner at the top of every page.
|
# Setting this to True will display a "maintenance mode" banner at the top of every page.
|
||||||
MAINTENANCE_MODE = False
|
MAINTENANCE_MODE = False
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@ ADMINS = getattr(configuration, 'ADMINS', [])
|
|||||||
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)
|
||||||
|
BASE_PATH = getattr(configuration, 'BASE_PATH', '')
|
||||||
|
if BASE_PATH:
|
||||||
|
BASE_PATH = BASE_PATH.strip('/') + '/' # Enforce trailing slash only
|
||||||
MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False)
|
MAINTENANCE_MODE = getattr(configuration, 'MAINTENANCE_MODE', False)
|
||||||
PAGINATE_COUNT = getattr(configuration, 'PAGINATE_COUNT', 50)
|
PAGINATE_COUNT = getattr(configuration, 'PAGINATE_COUNT', 50)
|
||||||
NETBOX_USERNAME = getattr(configuration, 'NETBOX_USERNAME', '')
|
NETBOX_USERNAME = getattr(configuration, 'NETBOX_USERNAME', '')
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from django.conf import settings
|
||||||
from django.conf.urls import include, url
|
from django.conf.urls import include, url
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.views.defaults import page_not_found
|
from django.views.defaults import page_not_found
|
||||||
@ -10,6 +11,8 @@ handler500 = handle_500
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
||||||
|
url(r'^{}'.format(settings.BASE_PATH), include([
|
||||||
|
|
||||||
# Default page
|
# Default page
|
||||||
url(r'^$', home, name='home'),
|
url(r'^$', home, name='home'),
|
||||||
|
|
||||||
@ -41,4 +44,6 @@ urlpatterns = [
|
|||||||
# Admin
|
# Admin
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
||||||
|
]))
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<pre><strong>{{ exception }}</strong><br />
|
<pre><strong>{{ exception }}</strong><br />
|
||||||
{{ error }}</pre>
|
{{ error }}</pre>
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<a href="/" class="btn btn-primary">Home Page</a>
|
<a href="{% url 'home' %}" class="btn btn-primary">Home Page</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="/">
|
<a class="navbar-brand" href="{% url 'home' %}">
|
||||||
<img src="{% static 'img/netbox_logo.png' %}" />
|
<img src="{% static 'img/netbox_logo.png' %}" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -289,7 +289,7 @@
|
|||||||
<div class="col-xs-4 text-right">
|
<div class="col-xs-4 text-right">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<i class="fa fa-fw fa-book text-primary"></i> <a href="http://netbox.readthedocs.io/" target="_blank">Docs</a> ·
|
<i class="fa fa-fw fa-book text-primary"></i> <a href="http://netbox.readthedocs.io/" target="_blank">Docs</a> ·
|
||||||
<i class="fa fa-fw fa-cloud text-primary"></i> <a href="/api/docs/">API</a> ·
|
<i class="fa fa-fw fa-cloud text-primary"></i> <a href="{% url 'django.swagger.base.view' %}">API</a> ·
|
||||||
<i class="fa fa-fw fa-code text-primary"></i> <a href="https://github.com/digitalocean/netbox">Code</a>
|
<i class="fa fa-fw fa-code text-primary"></i> <a href="https://github.com/digitalocean/netbox">Code</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -545,13 +545,13 @@ function toggleConnection(elem, api_url) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$(".consoleport-toggle").click(function() {
|
$(".consoleport-toggle").click(function() {
|
||||||
return toggleConnection($(this), "/api/dcim/console-ports/");
|
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/console-ports/");
|
||||||
});
|
});
|
||||||
$(".powerport-toggle").click(function() {
|
$(".powerport-toggle").click(function() {
|
||||||
return toggleConnection($(this), "/api/dcim/power-ports/");
|
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/power-ports/");
|
||||||
});
|
});
|
||||||
$(".interface-toggle").click(function() {
|
$(".interface-toggle").click(function() {
|
||||||
return toggleConnection($(this), "/api/dcim/interface-connections/");
|
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/interface-connections/");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<script src="{% static 'js/graphs.js' %}"></script>
|
<script src="{% static 'js/graphs.js' %}"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user