Code Monkey home page Code Monkey logo

Comments (5)

jamalex avatar jamalex commented on August 23, 2024

Fixed in 3206d43

from kolibri.

benjaoming avatar benjaoming commented on August 23, 2024

Two options:

  1. Running django.setup() before enabling/disabling a plugin (in kolibri.utils.cli.plugin). That way, we just know that the django stack is ready when loading kolibri_plugin which requires less carefulness when writing plugins.

  2. Moving the import of urls modules to MyKolibriPlugin.url_module. This way, we know that loading kolibri_plugin is less error prone because it doesn't depend on a functional django stack. So for instance if a plugin has broken something in the Django stack (for instance its views or models are invalid), we can still enable/disable the plugin.

from kolibri.

benjaoming avatar benjaoming commented on August 23, 2024

I'm wondering if option 2 is too restrictive. That way, a plugin cannot access its own models when it's being enabled. On the other hand, things like migrations may not have been fired.

Can anybody advice on what plugins currently HAVE to be able to do when enabled? I can't see that any of the core plugins have custom enable() class methods anyways.

from kolibri.

benjaoming avatar benjaoming commented on August 23, 2024

I'm wondering if option 1 is too restrictive. That way, a plugin cannot access its own models when it's being enabled. On the other hand, things like migrations may not have been fired.

Following up on this: Since one may run enable->disable->enable, with each operation starting and exiting Kolibri, I believe that plugins should not make lots of assumptions about initial states while running enable. This is just a caution.

Anyways, because commands such as collectstatic and migrate have to be run, we also have to run django.setup() anyways.

Here's a rough vision of what enabling a plugin could look like:

$ kolibri plugin enable kolibri.plugins.learn

Enabling plugin: kolibri.plugins.learn

Verifying dependencies... OK!
Collecting static assets (JS/CSS/images)........ OK!
Running database migrations............ OK!

Plugin enabled. Please start/restart Kolibri.

from kolibri.

benjaoming avatar benjaoming commented on August 23, 2024

Replacing this issue with #2510

from kolibri.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.