#29554: Allow loading apps dynamically at runtime ------------------------------------+-------------------------------------- Reporter: Christian González | Owner: nobody Type: New feature | Status: closed Component: Core (Other) | Version: 2.0 Severity: Normal | Resolution: needsinfo Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 ------------------------------------+--------------------------------------
Comment (by Christian González): Should I discuss this on the mailing list then, or here? Just to answer your questions: * regarding the INSTALLED_APPS order: Sure, if you have a stati application, this order makes sense. If you have an application that uses plugins, the application itself is responsible for the order the plugins are loaded. To make this deterministic, would be nonsense IMHO, as different applications use different plugin methods (Django provides None). So It could be that there is a "plugin resolution order" where dependendant plugins are loaded after their dependencies - which makes sense, or the app could decide that plugins define an integer "weight" (which is no good practice IMHO), etc. So, that's the sense of "dynamic" apps. * Regarding templates, and which app wins - I always fount the templating system a bit difficult - IMHO app templates should have implicit namespaces. But that would break virtually any existing Django install - so forget it. But: Same as before: The loading order decides, like in {{{INSTALLED_APPS}}}. Let the application decide in which order the plugins should be loaded. In my simple mind, I call {{{apps.populate([myfirstapp_plugin, other_plugin, last_plugin_app])}}} like setup.py calls it with {{{settings.INSTALLED_APPS}}}. And populate works through all he apps **in this order** and merges them into the system. I wrote a Django application that merely consists of the plugin system. The "real" main application is already a "Core" plugin (with a version etc) which is listed in INSTALLED_APPS as app, because it is always loaded and part of the base system. And all other plugins are loaded dynamically. So they can have dependencies like "core>=1.5.2" and it won't load it when the core version is below that. It's pre-alpha, just look here for the extension system [https://gitlab.com/nerdocs/medux/MedUX/tree/develop/medux/extensionsystem] (e.g. the PluginManager, is in development. I'm no professional software engineer, so please look away if you see horrible coding style ;-) - or better tell me) I tried really many ways to accomplish that, and some of the first ones were plugins that are no django apps. But I came across some issues, and had to rewrite much of the stuff Django does already perfectly, like loading models, migrations, etc. So in the sense of DRY, I wanted to have plugins being Django apps. But there the problem I describe here starts: I have to restart the server, rewriting the settings.py - which is nonsense in my eyes. -- Ticket URL: <https://code.djangoproject.com/ticket/29554#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.621210242810dcb9f8b4bac0949310b5%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.