Skip to content

django.core.exceptions.ImproperlyConfigured: netbox_branching: DATABASES must be a DynamicSchemaDict instance. #277

Closed
@rubenjimenezit

Description

@rubenjimenezit

Plugin Version

0.5.5

NetBox Version

4.3.1

Python Version

3.10.12

Steps to Reproduce

Fresh new installation of Netbox 4.3.1 on Ubuntu 22.04
Trying to install netbox-branching plugin following instructions: https://netboxlabs.com/docs/console/netbox-extensions/branching/

Linux user 'netbox' session

GRANT CREATE ON DATABASE netbox TO netbox;
source /opt/netbox/venv/bin/activate
pip install netboxlabs-netbox-branching

Modify file /opt/netbox/netbox/netbox/configuration.py

PLUGINS = [
    # ...
    'netbox_branching',
]

Created file /opt/netbox/netbox/netbox/local_settings.py with content:

from netbox_branching.utilities import DynamicSchemaDict
from .configuration import DATABASE

# Wrap DATABASES with DynamicSchemaDict for dynamic schema support
DATABASES = DynamicSchemaDict({
    'default': DATABASE,
})

# Employ our custom database router
DATABASE_ROUTERS = [
    'netbox_branching.database.BranchAwareRouter',
]
cd /opt/netbox/netbox
./manage.py migrate

The migrate process raises a Django Exception: ImproperlyConfigured: netbox_branching: DATABASES must be a DynamicSchemaDict instance.

It seems that the migrate process is not taking the local_settings.py file into account for the migration, although it is located in the same directory than settings.py (as documentation indicates)

(venv) netbox@netbox01:/opt/netbox/netbox/netbox$ ls -ls configuration.py settings.py local_settings.py
12 -rw-r----- 1 netbox root 10385 Jun  5 15:23 configuration.py
 4 -rw-rw-r-- 1 netbox root   332 Jun  5 14:48 local_settings.py
36 -rw-rw-r-- 1 netbox root 34203 Jun  5 14:58 settings.py

Thanks for your help!

Expected Behavior

Plugin installed

Observed Behavior

Traceback (most recent call last):
  File "/opt/netbox-4.3.1/netbox/./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-4.3.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-4.3.1/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/opt/netbox-4.3.1/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/netbox-4.3.1/venv/lib/python3.10/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/opt/netbox-4.3.1/venv/lib/python3.10/site-packages/netbox_branching/__init__.py", line 39, in ready
    raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: netbox_branching: DATABASES must be a DynamicSchemaDict instance.

Metadata

Metadata

Assignees

Labels

status: under reviewtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions