0

In my localhost server, I was able to restrict users from accessing pdf media files which they are not supposed to access given that they are not the uploader of the file or the admin of the system.

The problem is that when I tried to deploy my application, the restriction on my media files no longer works.

This is my urls.py

urlpatterns = [ path('media/pdf/<str:path>', views.pdf, name='pdf'), ]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root= settings.MEDIA_ROOT)

And my MEDIA_URL and MEDIA_ROOT in settings.py:

MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')

Also my debug is still set to TRUE in deployment, could this also be the problem?

prinxx
  • 1
  • 3

0 Answers0