overhangio / tutor-discovery

Course Discovery plugin for Tutor
GNU Affero General Public License v3.0
11 stars 40 forks source link

Media files not served by Discovery #69

Closed angonz closed 2 months ago

angonz commented 2 months ago

Media files located at /openedx/discovery/course_discovery/media are not served. Any attempt to open <discovery host>/media/... returns 404 Not Found error, even if the file exists in the correct directory.

The problem seems to be that the media directory does not exists in /openedx/discovery/course_discovery/ in a fresh new container when uwsgi is launched. Then the --static-map /media=/openedx/discovery/course_discovery/media option does not create the mapping, even if the directory is created afterwards.

I have tested adding RUN mkdir course_discovery/media to the Dockerfile and it seems to fix the problem.

angonz commented 2 months ago

I've created PR #70

Faraz32123 commented 2 months ago

Hi @angonz, let me know what kind of content you were trying to upload and from where you were uploading it. And it wasn't working for you before? Can you please attach some screenshot for the better understanding and tell the steps to reproduce this issue and its fix.

angonz commented 2 months ago

Hi @Faraz32123, We ran tutor k8s exec discovery ./manage.py refresh_course_metadata --partner_code=openedx and tutor k8s exec discovery ./manage.py download_course_images --overwrite. We can see that the files are created in /openedx/discovery/course_discovery/media/ inside the discovery container. However they are not served in the <discovery host>/media/... url. After patching the container (just adding the /openedx/discovery/course_discovery/media directory at build time) it started to work as expected.

Danyal-Faheem commented 2 months ago

Closing this issue as completed by #70.