0

In my settings.py, I have STATIC_URL='/static/'

I have a view which I use as a fallback for the static url

class MyView(View):
    def get(request):
        return XXX

which I add it to my urls like so

urlpatterns += [url(r'^/static/', MyView.as_view())]

Next, I want to make sure that the fallback URL is working. When I go to a bad link like localhost/static/garbage it shows me the Django 404 error page but it claims that it was raised by MyView.

What's extremely frustrating is I have two apps with the same static files handling. One of the apps trigger my view, the other does not. I cannot tell what's different that's causing the issue. Both are on whitenoise==4.1.x and django==2.3

4

1 に答える 1