I’m having trouble finding an example of, or understanding how to add additional urlpatterns to urls.py via a plugin.
urlpatterns += (
url(r'^api/additional_path/', include('new_package.rest.urls', namespace='new_package')),
I’m in the process of converting some of the minor changes in my deployment over to the tutor plugin system to eliminate the need to fork the main edx-platform, but I’m a little stuck on how to approach targeted changes such as this, or adding additional default xblocks in newly created courses
I have been looking over the provided python package examples mentioned in the tutor plugin documentation, and having trouble deciphering where if at all this type of addition is taking place. (for all i know i’ve looked right at it and didn’t realize)
From what i can gather from forum hopping the past few days, i need to:
- generate a new plugin with cookiecutter,
- and add a patch being that this makes a file change
and i have started this process, but i’m having trouble identifying what needs to be there
Can anyone recommend a starting point for how i would go about this? or point me to an example of this being done?
Hi @crivet! You are right that modifying
urls.py is not explained in the tutor docs – and for good reason: the mechanism by which you extend urls.py is not quite related to Tutor plugins, or Tutor for that matter.
I assume you are talking about the
urls.py file from the LMS, in edx-platform, right? The best and most forward-compatible way for you to add urls to this file is to create a “Django app plugin” for edx-platform. This is an Open edX-specific way of extending edx-platform that is documented here: edx-django-utils/README.rst at master · edx/edx-django-utils · GitHub
Once you created your Django app plugin, you can use Tutor to install it next to edx-platform in the openedx Docker image. For that, you could (for instance) refer to the “installing extra requirements” section from the Tutor docs: Configuration and customisation — Tutor documentation Your plugin should then be auto-detected by edx-platform at runtime.
Does it make more sense?
Yes, that’s correct. For my current task, i need to add an additional url pattern to both lms & cms/urls.py as well as add an additional installed app in lms&cms/envs/common.py
(which i assume will be doable with a patch to openedx-common-settings)
I’ll need to dig a bit deeper into developing an edx “Django app plugin” as i haven’t encountered this yet, but at least I have a starting point
If you have any additional beginner advice on this process, or know of a sample plugin I could use as reference, it’s welcomed
Thanks for the starting point
Hi @crivet .Is there any new about this??
Nothing successful as of yet on my end. From what i understand this is done via django plugins.
Edx provides several cookie cutter projects to develop this, but i haven’t gotten it working in my case.
Theoretically, it should boil down to:
from the above linked project and adding the additional urls in the AppConfig object.
then adding it as a requirement in to the tutor config’s
tutor images build openedx to install it within the container
In my attempts I’ve run into several dependency/requirement issues that i haven’t been able to resolve, so i have yet to be successful at this, but i do believe this is essentially the process.
Sorry I cannot be more helpful
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.