Django: static file serve does not work only when the url is "static/"

I have the following urls.py -

urlpatterns = [
                  path('admin/', include("admin.urls")),
                  path('accounts/', include("accounts.urls")),
                  path('blogs/', include("blogs.urls")),
              ] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

In the settings.py I have -

STATIC_URL = 'static/'
STATIC_ROOT = 'static/'

Here my static files in the static folder are showing a "Page Not Found (404)" error. But ifI change settings.STATIC_URL to anything else, it works. For example, if I do - static("anything/", document_root=settings.STATIC_ROOT), then it works, only the strings that start with 'static' does not work.

In short : It does not work if I use STATIC_URL in the static() function. Any other strings works.

Can anyone shed some light on this behaviour?

Back to Top