Coverage for netbox/configuration_example.py: 0%
39 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 18:35 +0000
1#########################
2# #
3# Required settings #
4# #
5#########################
7# This is a list of valid fully-qualified domain names (FQDNs) for the NetBox server. NetBox will not permit write
8# access to the server via any other hostnames. The first FQDN in the list will be treated as the preferred name.
9#
10# Example: ALLOWED_HOSTS = ['netbox.example.com', 'netbox.internal.local']
11ALLOWED_HOSTS = []
13# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
14# https://docs.djangoproject.com/en/stable/ref/settings/#databases
15DATABASES = {
16 'default': {
17 'ENGINE': 'django.db.backends.postgresql', # Database engine
18 'NAME': 'netbox', # Database name
19 'USER': '', # PostgreSQL username
20 'PASSWORD': '', # PostgreSQL password
21 'HOST': 'localhost', # Database server
22 'PORT': '', # Database port (leave blank for default)
23 'CONN_MAX_AGE': 300, # Max database connection age
24 }
25}
27# Redis database settings. Redis is used for caching and for queuing background tasks such as webhook events. A separate
28# configuration exists for each. Full connection details are required in both sections, and it is strongly recommended
29# to use two separate database IDs.
30REDIS = {
31 'tasks': {
32 'HOST': 'localhost',
33 'PORT': 6379,
34 # Comment out `HOST` and `PORT` lines and uncomment the following if using Redis Sentinel
35 # 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
36 # 'SENTINEL_SERVICE': 'netbox',
37 'USERNAME': '',
38 'PASSWORD': '',
39 'DATABASE': 0,
40 'SSL': False,
41 # Set this to True to skip TLS certificate verification
42 # This can expose the connection to attacks, be careful
43 # 'INSECURE_SKIP_TLS_VERIFY': False,
44 # Set a path to a certificate authority, typically used with a self signed certificate.
45 # 'CA_CERT_PATH': '/etc/ssl/certs/ca.crt',
46 },
47 'caching': {
48 'HOST': 'localhost',
49 'PORT': 6379,
50 # Comment out `HOST` and `PORT` lines and uncomment the following if using Redis Sentinel
51 # 'SENTINELS': [('mysentinel.redis.example.com', 6379)],
52 # 'SENTINEL_SERVICE': 'netbox',
53 'USERNAME': '',
54 'PASSWORD': '',
55 'DATABASE': 1,
56 'SSL': False,
57 # Set this to True to skip TLS certificate verification
58 # This can expose the connection to attacks, be careful
59 # 'INSECURE_SKIP_TLS_VERIFY': False,
60 # Set a path to a certificate authority, typically used with a self signed certificate.
61 # 'CA_CERT_PATH': '/etc/ssl/certs/ca.crt',
62 }
63}
65# This key is used for secure generation of random numbers and strings. It must never be exposed outside of this file.
66# For optimal security, SECRET_KEY should be at least 50 characters in length and contain a mix of letters, numbers, and
67# symbols. NetBox will not run without this defined. For more information, see
68# https://docs.djangoproject.com/en/stable/ref/settings/#std:setting-SECRET_KEY
69SECRET_KEY = ''
71# Define a mapping of cryptographic peppers to use when hashing API tokens. A minimum of one pepper is required to
72# enable v2 API tokens (NetBox v4.5+). Define peppers as a mapping of numeric ID to pepper value, as shown below. Each
73# pepper must be at least 50 characters in length.
74#
75# API_TOKEN_PEPPERS = {
76# 1: "<random string>",
77# 2: "<random string>",
78# }
79API_TOKEN_PEPPERS = {}
82#########################
83# #
84# Optional settings #
85# #
86#########################
88# Specify one or more name and email address tuples representing NetBox administrators. These people will be notified of
89# application errors (assuming correct email settings are provided).
90ADMINS = [
91 # ('John Doe', 'jdoe@example.com'),
92]
94# Enable any desired validators for local account passwords below. For a list of included validators, please see the
95# Django documentation at https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-validation.
96AUTH_PASSWORD_VALIDATORS = [
97 # {
98 # 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
99 # 'OPTIONS': {
100 # 'min_length': 10,
101 # }
102 # },
103]
105# Base URL path if accessing NetBox within a directory. For example, if installed at https://example.com/netbox/, set:
106# BASE_PATH = 'netbox/'
107BASE_PATH = ''
109# API Cross-Origin Resource Sharing (CORS) settings. If CORS_ORIGIN_ALLOW_ALL is set to True, all origins will be
110# allowed. Otherwise, define a list of allowed origins using either CORS_ORIGIN_WHITELIST or
111# CORS_ORIGIN_REGEX_WHITELIST. For more information, see https://github.com/ottoyiu/django-cors-headers
112CORS_ORIGIN_ALLOW_ALL = False
113CORS_ORIGIN_WHITELIST = [
114 # 'https://hostname.example.com',
115]
116CORS_ORIGIN_REGEX_WHITELIST = [
117 # r'^(https?://)?(\w+\.)?example\.com$',
118]
120# The name to use for the CSRF token cookie.
121CSRF_COOKIE_NAME = 'csrftoken'
123# Set to True to enable server debugging. WARNING: Debugging introduces a substantial performance penalty and may reveal
124# sensitive information about your installation. Only enable debugging while performing testing. Never enable debugging
125# on a production system.
126DEBUG = False
128# Set the default preferred language/locale
129DEFAULT_LANGUAGE = 'en-us'
131# Email settings
132EMAIL = {
133 'SERVER': 'localhost',
134 'PORT': 25,
135 'USERNAME': '',
136 'PASSWORD': '',
137 'USE_SSL': False,
138 'USE_TLS': False,
139 'TIMEOUT': 10, # seconds
140 'FROM_EMAIL': '',
141}
143# Return CSV bulk exports as a streaming HTTP response, which avoids buffering the entire dataset in memory before
144# sending it to the client. This is recommended for very large exports, but it alters the response behavior so it is
145# disabled by default.
146STREAMING_EXPORTS = False
148# Exempt certain models from the enforcement of view permissions. Models listed here will be viewable by all users and
149# by anonymous users. List models in the form `<app>.<model>`. Add '*' to this list to exempt all models.
150EXEMPT_VIEW_PERMISSIONS = [
151 # 'dcim.site',
152 # 'dcim.region',
153 # 'ipam.prefix',
154]
156# HTTP proxies NetBox should use when sending outbound HTTP requests (e.g. for webhooks).
157# HTTP_PROXIES = {
158# 'http': 'http://10.10.1.10:3128',
159# 'https': 'http://10.10.1.10:1080',
160# }
162# Enable custom logging. Please see the Django documentation for detailed guidance on configuring custom logs:
163# https://docs.djangoproject.com/en/stable/topics/logging/
164LOGGING = {}
166# Automatically reset the lifetime of a valid session upon each authenticated request. Enables users to remain
167# authenticated to NetBox indefinitely.
168LOGIN_PERSISTENCE = False
170# The length of time (in seconds) for which a user will remain logged into the web UI before being prompted to
171# re-authenticate. If set to None (the default), Django's SESSION_COOKIE_AGE is used (two weeks).
172LOGIN_TIMEOUT = None
174# Hide the login form. Useful when only allowing SSO authentication.
175LOGIN_FORM_HIDDEN = False
177# The view name or URL to which users are redirected after logging out.
178LOGOUT_REDIRECT_URL = 'home'
180# The file path where uploaded media such as image attachments are stored. A trailing slash is not needed. Note that
181# the default value of this setting is derived from the installed location.
182# MEDIA_ROOT = '/path/to/netbox/media'
184# Expose Prometheus monitoring metrics at the HTTP endpoint '/metrics'
185METRICS_ENABLED = False
187# Enable installed plugins. Add the name of each plugin to the list.
188PLUGINS = []
190# Plugins configuration settings. These settings are used by various plugins that the user may have installed.
191# Each key in the dictionary is the name of an installed plugin and its value is a dictionary of settings.
192# PLUGINS_CONFIG = {
193# 'my_plugin': {
194# 'foo': 'bar',
195# 'buzz': 'bazz'
196# }
197# }
199# Remote authentication support
200REMOTE_AUTH_ENABLED = False
201REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
202REMOTE_AUTH_HEADER = 'HTTP_REMOTE_USER'
203REMOTE_AUTH_USER_FIRST_NAME = 'HTTP_REMOTE_USER_FIRST_NAME'
204REMOTE_AUTH_USER_LAST_NAME = 'HTTP_REMOTE_USER_LAST_NAME'
205REMOTE_AUTH_USER_EMAIL = 'HTTP_REMOTE_USER_EMAIL'
206REMOTE_AUTH_AUTO_CREATE_USER = True
207REMOTE_AUTH_DEFAULT_GROUPS = []
208REMOTE_AUTH_DEFAULT_PERMISSIONS = {}
210# This repository is used to check whether there is a new release of NetBox available. Set to None to disable the
211# version check or use the URL below to check for release in the official NetBox repository.
212RELEASE_CHECK_URL = None
213# RELEASE_CHECK_URL = 'https://api.github.com/repos/netbox-community/netbox/releases'
215# The file path where custom reports will be stored. A trailing slash is not needed. Note that the default value of
216# this setting is derived from the installed location.
217# REPORTS_ROOT = '/path/to/netbox/reports'
219# Maximum execution time for background tasks, in seconds.
220RQ_DEFAULT_TIMEOUT = 300
222# The file path where custom scripts will be stored. A trailing slash is not needed. Note that the default value of
223# this setting is derived from the installed location.
224# SCRIPTS_ROOT = '/path/to/netbox/scripts'
226# The default maximum time (in seconds) to wait for a response when sending a webhook, unless overridden on the
227# individual webhook. Keeping this below RQ_DEFAULT_TIMEOUT gives an unresponsive receiver a chance to be cut off
228# by the request timeout rather than by termination of the background job. This must be less than
229# RQ_DEFAULT_TIMEOUT.
230WEBHOOK_DEFAULT_TIMEOUT = 60
232# The name to use for the session cookie.
233SESSION_COOKIE_NAME = 'sessionid'
235# By default, NetBox will store session data in the database. Alternatively, a file path can be specified here to use
236# local file storage instead. (This can be useful for enabling authentication on a standby instance with read-only
237# database access.) Note that the user as which NetBox runs must have read and write permissions to this path.
238SESSION_FILE_PATH = None
240# By default the memory and disk sizes are displayed using base 10 (e.g. 1000 MB = 1 GB).
241# If you would like to use base 2 (e.g. 1024 MB = 1 GB) set this to 1024.
242# DISK_BASE_UNIT = 1024
243# RAM_BASE_UNIT = 1024
245# Within the STORAGES dictionary, "default" is used for image uploads, "staticfiles" is for static files and "scripts"
246# is used for custom scripts. See django-storages and django-storage-swift libraries for more details. By default the
247# following configuration is used:
248# STORAGES = {
249# "default": {
250# "BACKEND": "django.core.files.storage.FileSystemStorage",
251# },
252# "staticfiles": {
253# "BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
254# },
255# "scripts": {
256# "BACKEND": "extras.storage.ScriptFileSystemStorage",
257# "OPTIONS": {
258# "allow_overwrite": True,
259# },
260# },
261# }
263# Time zone (default: UTC)
264TIME_ZONE = 'UTC'