How to add new features like django apps in tutor?

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 :sweat_smile:

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:

  1. Install with pip install -e . within this folder within the edx platform virtual environment.
  2. 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.)
  3. Run migrations.
  4. Start/restart the LMS.

Templates Directory

Add this to envs.common:

TEMPLATES_DIR = { … OPENEDX_ROOT / ‘features’ / ‘name_of_repository’ / ‘templates’, }

ADD TO LMS URLS

urlpatterns += [ url(r’', include(‘name_of_repository_pages.urls’)), ]

but it seems quite difficult to trace here in tutor. I have read the tutor docs but I am confused because as I have said, I am a complete beginner.

Please help me. I don’t know how to include a feature on our newly running openedx-tutor instance.

Is this your own django app or an existing third party django app?

If it’s your own django app and it’s focused on Open edX, the best way to do it is probably by implementing it as a django app plugin. In that case, you don’t need to make a Tutor plugin at all; you just need to use one of the two methods for installing an additional python package.

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.

2 Likes

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.

The instructions are on the page I linked to. There are also many examples included with Open edX: announcements, bookmarks, discussion, and more.

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?