Static files server for dev doesn't behave as expected with flatpage app
|Reported by:||christandiono||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Or does it? (I tried searching for this bug but I didn't find it...)
The problem happens when a flatpage has the same URL as a static files directory.
The way the static server works is it adds an extra URL pattern: for everything that's not covered by the other URLs in urls.py, first try to serve it as a static file, then if the file doesn't exist return 404. The flatpage middleware waits for a 404, and if there is a 404 it will show the flatpage.
So in production, the flatpage will be served first before attempting to show the directory contents (if allowed by .htaccess or httpd.conf or whatever it is that's being used). For the dev server, the directory contents will be served first before attempting to show the flatpage.
The workaround is to disable showing directory listings in the configuration for the static files server.
I don't really know if this is worth fixing, but it's kind odd to have to disable showing directory listings (which may be useful) in order to show flatpages. At the very least it's unintuitive...