mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Adds ENGINE to database config (#12458)
* adds ENGINE to database config #11791 * fixed lint issues * updated doc
This commit is contained in:
parent
4df517e4da
commit
93b912c2da
@ -33,11 +33,13 @@ NetBox requires access to a PostgreSQL 11 or later database service to store dat
|
|||||||
* `HOST` - Name or IP address of the database server (use `localhost` if running locally)
|
* `HOST` - Name or IP address of the database server (use `localhost` if running locally)
|
||||||
* `PORT` - TCP port of the PostgreSQL service; leave blank for default port (TCP/5432)
|
* `PORT` - TCP port of the PostgreSQL service; leave blank for default port (TCP/5432)
|
||||||
* `CONN_MAX_AGE` - Lifetime of a [persistent database connection](https://docs.djangoproject.com/en/stable/ref/databases/#persistent-connections), in seconds (300 is the default)
|
* `CONN_MAX_AGE` - Lifetime of a [persistent database connection](https://docs.djangoproject.com/en/stable/ref/databases/#persistent-connections), in seconds (300 is the default)
|
||||||
|
* `ENGINE` - The database backend to use; must be a PostgreSQL-compatible backend (e.g. `django.db.backends.postgresql`)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
DATABASE = {
|
DATABASE = {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': 'netbox', # Database name
|
'NAME': 'netbox', # Database name
|
||||||
'USER': 'netbox', # PostgreSQL username
|
'USER': 'netbox', # PostgreSQL username
|
||||||
'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password
|
'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password
|
||||||
@ -50,6 +52,9 @@ DATABASE = {
|
|||||||
!!! note
|
!!! note
|
||||||
NetBox supports all PostgreSQL database options supported by the underlying Django framework. For a complete list of available parameters, please see [the Django documentation](https://docs.djangoproject.com/en/stable/ref/settings/#databases).
|
NetBox supports all PostgreSQL database options supported by the underlying Django framework. For a complete list of available parameters, please see [the Django documentation](https://docs.djangoproject.com/en/stable/ref/settings/#databases).
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
Make sure to use a PostgreSQL-compatible backend for the ENGINE setting. If you don't specify an ENGINE, the default will be django.db.backends.postgresql.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## REDIS
|
## REDIS
|
||||||
|
@ -13,6 +13,7 @@ ALLOWED_HOSTS = []
|
|||||||
# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
|
# PostgreSQL database configuration. See the Django documentation for a complete list of available parameters:
|
||||||
# https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
# https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
||||||
DATABASE = {
|
DATABASE = {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql', # Database engine
|
||||||
'NAME': 'netbox', # Database name
|
'NAME': 'netbox', # Database name
|
||||||
'USER': '', # PostgreSQL username
|
'USER': '', # PostgreSQL username
|
||||||
'PASSWORD': '', # PostgreSQL password
|
'PASSWORD': '', # PostgreSQL password
|
||||||
|
@ -182,15 +182,16 @@ if RELEASE_CHECK_URL:
|
|||||||
# Database
|
# Database
|
||||||
#
|
#
|
||||||
|
|
||||||
# Only PostgreSQL is supported
|
if 'ENGINE' not in DATABASE:
|
||||||
if METRICS_ENABLED:
|
# Only PostgreSQL is supported
|
||||||
DATABASE.update({
|
if METRICS_ENABLED:
|
||||||
'ENGINE': 'django_prometheus.db.backends.postgresql'
|
DATABASE.update({
|
||||||
})
|
'ENGINE': 'django_prometheus.db.backends.postgresql'
|
||||||
else:
|
})
|
||||||
DATABASE.update({
|
else:
|
||||||
'ENGINE': 'django.db.backends.postgresql'
|
DATABASE.update({
|
||||||
})
|
'ENGINE': 'django.db.backends.postgresql'
|
||||||
|
})
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': DATABASE,
|
'default': DATABASE,
|
||||||
|
Loading…
Reference in New Issue
Block a user