I am playing with plugins in tutor, and I want to create a receiver for Django Signals. At this point everything is fine, the problem comes because I do not know where to connect my plugin entry point together with the hook.
I have created a python package, and I can install it using tutor into Open edX -it seems it works-, but I have a receiver to hook the Django signal -with some dummy logic- and I do not know how to install/setup into Open edX, or where it should be declared into Open edX⊠when I understand how it should be integrated I guess I will understand how to modify the plugin (patch, hook,âŠ) I have just created.
As far as I understood your question, signals are setup in same way as we are doing in any simple django app in signal.py but If you want recieve some openedx event like course updated, published then event name is different otherwise for normal django model itâs same.
Where does your plugin entry point live? In a separate Python package? Is it a reusable Django application? It should; then I believe all you have to do is to add it to your INSTALLED_APPS in the LMS (or the CMS).
Thanks both for the reply. My entry point is a hook in the init of LMS - Open edX where I have to decide how to modify the docker-image to add MySignalsApp. At this point, I have a tutor-plugin in one hand, and my-app to control Django Signals in another, how to put both together? Not sure how should I do it.
It looks like you are conflating two very different things here:
You should use a Tutor patch to install your re-usable application in the Docker container. You should probably have a âopenedx-dockerfileâ patch with the following content: RUN pip install myreusableapp. Then you will need to re-build the openedx Docker image (tutor images build openedx).
To add the reusable app to the LMS, you should add its name to the list of INSTALLED_APPS. To do so, you should again use a Tutor patch â probably the âopenedx-lms-common-settingsâ patch, where you will write: INSTALLED_APPS.append("myreusableapp").
To add the reusable app to the LMS, you should add its name to the list of INSTALLED_APPS. To do so, you should again use a Tutor patch â probably the âopenedx-lms-common-settingsâ patch, where you will write: INSTALLED_APPS.append("myreusableapp") .
You can actually use the plugin system for this step to automatically install the djangoapp [1]. It also reference signals in the README, so it could maybe help you installing the signals (Many options are optional, as an example, here is an app that is installed only with the pip install step [2][3]).
Yes, this is actually a better solution. Thanks for pointing this out. (Felipe is referring to the Open edX plugin system, totally unrelated with the Tutor plugin system)
I come back to give you thanks for your help! In the end, it was easier for me going from the Django app approach, updating manually the INSTALLED_APP settings. It works like a charm! One only trick: as I need to install a local python package into the tutor-openedx system, I run a script as follow:
1. Update tutor plugin, contains patches to install my Django App (python package):
pip install <local_path_tutor_plugin>
tutor plugins enable <tutor_plugin>
tutor config save
2. Move python package (django app) into Open edX (tutor system)