-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Plugins to register a list of Django apps to be appended to INSTALLED_APPS #9880
Comments
This can be assigned to me and I can work on a PR if accepted. |
One thing to consider is the order in which apps are loaded. I don't know if it's something we need to address for plugins, but this has come up in core development. For example, we have to list |
As mentioned in the
Are you requesting for the ability to do the opposite ? |
I'm pointing out that it needs to be considered because there are scenarios where it may be required, such as the example I cited. |
In that case we may consider the order of the list django_apps = ["foo", "bar", "my_netbox_plugin", "baz"] If This would in turn define the import order for the apps and plugin. |
Thinking about this further, I can't come up with a scenario where you would need to load another Django app after a plugin which depends on it, so maybe it doesn't matter so long as the dependencies are loaded before all plugins. |
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 newdjango_apps
attribute which would get appended toINSTALLED_APPS
.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
The text was updated successfully, but these errors were encountered: