Hello everyone,
There is obviously some difference between installing an XBlock or module using these methods listed below. The first method works, but the second method generates a TemplateDoesNotExist
exception when accessing the openedx.course_tab
module. Iโm hoping that someone can shed some light on this for me.
Question: What is the correct method of setting or referencing the templates directory in an openedx.course_tab
module so that they are found?
-
Cloning the rocketchat-tab module first and then adding the path to the
requirements/private.txt
file works.cd $(tutor config printroot)/env/build/openedx/requirements # Clone and then install (works as expected) git clone https://github.com/tony-h/rocketchat-tab.git echo "-e ./rocketchat-tab/" >> private.txt
-
However, installing it by adding
git+https://repo-path.git
to therequirements/private.txt
generates aTemplateDoesNotExist
exception when the new tab is opened.cd $(tutor config printroot)/env/build/openedx/requirements # Installs, but can't find the template echo "git+https://github.com/tony-h/rocketchat-tab.git" >> private.txt
The stack trace:
lms_1 | 2022-08-22 05:13:46,277 ERROR 49 [django.request] [user 34] [ip 91.197.235.251] log.py:224 - Internal Server Error: /courses/course-v1:CS+CC+2022/chat
lms_1 | Traceback (most recent call last):
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
lms_1 | response = get_response(request)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
lms_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
lms_1 | File "/opt/pyenv/versions/3.8.12/lib/python3.8/contextlib.py", line 75, in inner
lms_1 | return func(*args, **kwds)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
lms_1 | return self.dispatch(request, *args, **kwargs)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 98, in dispatch
lms_1 | return handler(request, *args, **kwargs)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/web_fragments/views.py", line 23, in get
lms_1 | fragment = self.render_to_fragment(request, **kwargs)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/rocketchat_tab/views.py", line 83, in render_to_fragment
lms_1 | html = render_to_string(
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/template/loader.py", line 61, in render_to_string
lms_1 | template = get_template(template_name, using=using)
lms_1 | File "/openedx/venv/lib/python3.8/site-packages/django/template/loader.py", line 19, in get_template
lms_1 | raise TemplateDoesNotExist(template_name, chain=chain)
lms_1 | django.template.exceptions.TemplateDoesNotExist: rocket_chat/rocket_chat.html
I can confirm that the template or static directories do not exist in the site-packages directory after installation. Where did they go? find ~ -type f -name "rocket_chat.html"
returns an empty result.
app@11afc8e1bf60:~/venv/lib/python3.8/site-packages/rocketchat_tab$ ls -lh
total 64K
-rw-r--r-- 1 app app 89 Aug 22 16:21 admin.py
-rw-r--r-- 1 app app 5.6K Aug 22 16:21 ApiRequest.py
-rw-r--r-- 1 app app 850 Aug 22 16:21 apps.py
-rw-r--r-- 1 app app 0 Aug 22 16:21 __init__.py
drwxr-xr-x 3 app app 4.0K Aug 22 16:21 migrations
-rw-r--r-- 1 app app 83 Aug 22 16:21 models.py
-rw-r--r-- 1 app app 773 Aug 22 16:21 plugins.py
drwxr-xr-x 2 app app 4.0K Aug 22 16:21 __pycache__
-rw-r--r-- 1 app app 772 Aug 22 16:21 RocketChatError.py
-rw-r--r-- 1 app app 11K Aug 22 16:21 RocketChat.py
drwxr-xr-x 3 app app 4.0K Aug 22 16:21 settings
-rw-r--r-- 1 app app 315 Aug 22 16:21 urls.py
-rw-r--r-- 1 app app 4.2K Aug 22 16:21 views.py
app@11afc8e1bf60:~/venv/lib/python3.8/site-packages/rocketchat_tab$
Any ideas on how to set the reference to the templates and static files so that Open edX can locate them?
Many thanks