Hello,
I'm asking myself since a while how to create a Django app with plugins.
I mean an extensible application that can be extended by plugins from an
"app store". I did a lot of research on that, and it's not easy to
manage it.
I'm doing that using partly the REST framework for an API, and graphene
for primary communication from the (Vue) client to the server, Django
channels for communication from server to client.
The plugins must be able to:
* have own models
* have own code that plunges into existing hooks (already done using a
plugin system)
* have own URLs
* have own Graphene Schema (works using plugin system)
* have own REST serializers (should work using my plugin system)
* etc.
The main problem is that dynamic loading of Django APPS is not really
possible since Django somewhat 1.7-1.9 with the new loading system. So
everything that stands in settings.py is frozen after Django has started.
Apps that are downloaded after that and inserted into the system, are
"ignored" by Django core.
What I did so far: I made a PluginManager with a middleware that
dynamically searches a plugin directory for "apps", and adds their
Appconfig to django.apps. That does not really work well.
Is there a better possibility? Sure, I can make a custom format for
plugins, but I'd like NOT to reinvent Django's wheel and create
boilerplate code for loading models, migrations, schemas, admin parts,
etc. again when django apps do that already.
Has anyone created an application that dynamically loads code AFTER
Django start, with Django 2.0+?
If you'd like to see some code, have a look at
https://gitlab.com/nerdocs/medux/MedUX/tree/develop (the develop
branch), mostly at medux/extensionsystem/pluginmanager.py
I know all the stackexchange questions about dynamically loading code,
but that all only works for earlier Django versions.
Any help/hints welcome.
--
Dr. Christian González
https://www.nerdocs.at
+43 650 7644477
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/e5bc37d4-88ef-5f51-f4c5-758ba9bfa995%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment