Answer the question
In order to leave comments, you need to log in
Media display not working in Django?
For some reason, the display of media files is blocked.
In the settings.py file, I wrote everything that is needed:
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, "files", "static")
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
urlpatterns = [
path('admin/', admin.site.urls),
path('api/v1/', include('djoser.urls')),
path('api/v1/', include('djoser.urls.authtoken')),
path('api/v1/', include('product.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question