Answer the question
In order to leave comments, you need to log in
How to distribute media files in django?
Goodnight! I can NOT display files from the media folder with DEBUG=True, while files from static work fine. Please tell me what could be the problem!?
MEDIA_ROOT = os.path.join(BASE_DIR, "files", "media")
MEDIA_URL = "/files/media/"
STATIC_ROOT = os.path.join(BASE_DIR, "files", "static")
STATIC_URL = "/files/static/"
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "templates", "static"),
]
STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.FileSystemFinder",
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
Answer the question
In order to leave comments, you need to log in
urlpatterns = patterns('',
# ... the rest of your URLconf goes here ...
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
more here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question