I\'m running a django 1.4.1 app.
I didn\'t realize that just including django.contrib.staticfiles
into INSTALLED_APPS
in your settings is e
I just figured this out after posting…
If you're using django-admin.py runserver
or python manage.py runserver
, then it does some extra magic to add a staticfiles handler that your regular middleware can't touch.
You can disable this by running django-admin.py runserver --nostatic
— see the django docs
And when you do --nostatic
it will fall back to the urls in your app, such as if you include staticfiles_urls() directly with:
urlpatterns += staticfiles_urlpatterns()
then your middleware will run for those urls (and of course all your others).
Found this issue when trying to modify request.path with middleware.
Discovered urls resolve against request.path_info
not request.path