This might be a dumb question but in the documentation it says:
Serving files uploaded by a user during development.¶
During development, you can serve user-uploaded media files from MEDIA_ROOT using the
django.contrib.staticfiles.views.serve()
view.This is not suitable for production use! For some common deployment strategies, see Deploying static files.
For example, if your MEDIA_URL is defined as /media/, you can do this by adding the following snippet to your urls.py:
from django.conf import settings from django.conf.urls.static import static urlpatterns = [ # ... the rest of your URLconf goes here ... ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Does that mean for production use + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
should not be used or should be used?
The way I understood this is that you shouldn't use django.contrib.staticfiles.views.serve()
but I'm not sure if that's not the same