Answer the question
In order to leave comments, you need to log in
What are these lines for?
Throughout my study of Django, with the tutorial on including media files, I have always seen that in the urls.py of the application of the project itself, these two lines are written:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += static(settings. STATIC_URL, document_root=settings.STATIC_ROOT)
I didn't find a sensible and understandable explanation anywhere, please explain.
Answer the question
In order to leave comments, you need to log in
In short, to form the correct URL for statics in the browser for a while while development is underway and the project is launched through the built-in server.
In the real world, this is done by the server (nginx/apache...)
Read more:
https://stackoverflow.com/questions/56352489/what-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question