I am wondering if this is a feature or a bug.
I have an ImageField
defined in my model and I am administering the model in the Admin dashboard. I uploaded an image for the field via the Admin dashboard.
Unless I set up this statement in the project settings.py file:
urlpatterns = [
path('admin/', admin.site.urls),
] + static( settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
the image won’t show up on the browser when I click on the link for it, e.g. http://localhost:8000/image/lego_OY3g6rJ.png
Now the MEDIA_URL
and MEDIA_ROOT
is not defined anywhere in my project settings.py file. Django does not complain.
Is this the default behavior of django? I’m using the latest, 3.2.4
. Thank you!