Good day! Before I begin, you may wonder that there is already an existing topic here regarding this matter related to this. But it has been closed already so I don’t even know if the process is still the same. Though I tried following their instructions, I still have a lot of questions since if you would ask me regarding my knowledge, I am a complete beginner. I am not even finished on my course in python django. Maybe by this way, all of you could figure out how low my programming skills were
Anyway, how do I add a django app to Tutor?
I saw an instruction before in a native installation to perform the following:
To Install:
Install with pip install -e . within this folder within the edx platform virtual environment.
Add “name_of_repository” to the “ADDL_INSTALLED_APPS” array in lms.env.json (you may have to create it if it doesn’t exist.)
If it’s an existing third party django app (that isn’t designed as a “django app plugin” for Open edX), then you will need to create a Tutor plugin to install and configure it. Installing an additional python package and adding to the Django settings (“envs.common”) are easy to do from a plugin; for the latter, it would work similarly to the Google Analytics example. But I am not sure about urls.py; the “old” Tutor plugins did not support modifying that file and I’m not sure if the “new” plugins API does or not. So this way definitely involves more unknowns that the django app plugin way.
Thank you for your response. In fact, your answer is clear on my end. Regarding your question:
here is my answer:
IT IS A THIRD PARTY DJANGO APP. It works on a native installed open edx but here in tutor, it doesn’t. But I can try to start it from scratch if I have to, so that I can further explore it so I could also consider this as my OWN DJANGO APP as well.
Also, you’ve mentioned that I can implement it as a django app plugin.
I would like to consider that idea. But I don’t know where to start. Can I have a detailed instructions on how to implement a django app plugin so I no longer have to make a tutor plugin? Also, if I perform this method, will the urls.py be detected automatically? I’m having a hard time understanding the instructions of the django app. So I tried implementing the django app plugin as far as I can understand. The moment I tried it, it doesn’t seem to work and my openedx instance can’t detect my app.
I think with your knowledge, you could help me more if you can please specify the implementation of django apps further. Maybe that way, I can figure out if I’m on the right track with django app plugins.
Please bear with my lack of expertise as a complete beginner.
Yes, if you configure the URL patterns like this in your apps.py file, your django app’s urls.py will be detected automatically.
Make sure you have installed it with pip install -e /path/to/your/app, and then if you run manage.py lms shell and from django.conf import settings and print settings.INSTALLED_APPS, you should see it?
I’ve been searching for a simple example on how to add a local developed django app as a plugin into Tutor.
There is a mix between tutor commands and open-edx ones, like the one above where pip is used, note that tutor is containerised to that will simply change nothing.
To make things easier, let’s assume I want to add an API endpoint into LMS under /api/hello/ that prints “Hello”.
Can anyone help, please?
And yes, I’ve been using all kinds of cookie cutters and nothing.
This is my plugin GitHub - cdot-ssau/tutor-scos, comments in russian, I am not aware about Django Plugins when started this project. In short, this plugin just copy app to Django apps directory and patch urls, installed apps… (openedx-dockerfile-pre-assets). Maybe this is not a good solution, but it works.