Opened 15 years ago

Closed 14 years ago

#13571 closed (wontfix)

Static files server for dev doesn't behave as expected with flatpage app

Reported by: Chris Tandiono Owned by: nobody
Component: Uncategorized Version: 1.1
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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...

Change History (1)

comment:1 by Russell Keith-Magee, 14 years ago

Resolution: wontfix
Status: newclosed

This isn't really a problem with the flatpages app; it's an inconsistency in the way static media being served. It will also be entirely dependent on your deployment configuration. If your deployment rules match your static media directory before your Django app, then static media will take priority; if the Django app is matched first, it will take priority.

Marking wontfix because this is something where we literally can't fix the problem; it just falls into that annoying category of bugs that will emerge during deployment.

Note: See TracTickets for help on using tickets.
Back to Top