Skip to content

Allow Plugins to register a list of Django apps to be appended to INSTALLED_APPS #9880

Closed
@jsenecal

Description

@jsenecal

NetBox version

v3.4

Feature type

New functionality

Proposed functionality

As discussed in #5086 (closed due to inactivity) it would be nice to allow for a plugin to append third-party Django Application into INSTALLED_APPS.

Borrowing from the issue above, the proposal is to extend the PluginConfig class to support a new django_apps attribute which would get appended to INSTALLED_APPS.

from extras.plugins import PluginConfig

class FooBarConfig(PluginConfig):
    name = 'foo_bar'
    verbose_name = 'Foo Bar'
    description = 'An example NetBox plugin'
    version = '0.1'
    author = 'Jeremy Stretch'
    author_email = 'author@example.com'
    base_url = 'foo-bar'
    required_settings = []
    default_settings = {
        'baz': True
    }
    django_apps = ["foo", "bar", "baz"] ### <<< HERE

config = FooBarConfig

These new apps should be inserted before the plugin that requires it, but after existing "core" apps in order to avoid conflicts.

The documentation should point out that additional apps may cause more harm than good and could lead to make identifying problems within NetBox itself more difficult or even cause problems. (But isn't that the case for every python package?)

Use case

When working with plugins, reusing third party libraries is a must to promote code re-use and allow for better functionality and ease of use.
Examples of that are apps that introduce new field types (with template tags), new templates, new models with migrations, new manage.py admin commands, etc. Most of the time, simply installing the python package for the additional app is simply not enough.

There are many existing Django apps that could be easily reused/extended within NetBox if we could seamlessly install them from a plugin.

Database changes

None within NetBox

External dependencies

None within NetBox

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtopic: pluginsRelates to the plugins frameworktype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions