Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#14524 closed (fixed)

Accessing /static/ in a new project shows simplistic 404 error page

Reported by: Fletcher Tomalty Owned by: Jannis Leidel
Component: Contrib apps Version: dev
Severity: Keywords: static, files
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

  1. Start a brand new project on the latest development version
  1. Use manage.py runserver
  1. Navigate to localhost:8000/static/
  1. See weird, undjango-like plain-text error page saying only "Page not found: /static/"


It looks like the addition of staticfiles caused new projects to serve static files on /static/ by default, which I'm pretty sure is a bug.

Change History (5)

comment:1 by Jannis Leidel, 14 years ago

milestone: 1.3
Owner: changed from nobody to Jannis Leidel
Status: newassigned
Triage Stage: UnreviewedAccepted

comment:2 by Jannis Leidel, 14 years ago

Summary: revision 14293 introduced static/ bugAccessing /static/ in a new project shows simplistic 404 error page

In previous versions this triggered a "Permission denied: /media/" error (in the same appearance), which is slightly less useful IMO and not really better than now. Question is we should return a standard 404 page instead.

comment:3 by Fletcher Tomalty, 14 years ago

Why would accessing /static/ trigger a "Permission denied: /media/" error? In previous versions /static/ gave the normal "It worked!" default page I think. The only reason there should be ANY 404s on either /static/ or /media/ is if you explicitly make one of them the location you are serving static files such as the admin media from. The admin isn't even on by default, and as far as I know there simply is no reason for /static/ or /media/ to work differently than any other pages on a new install.

Having said that, I'm a bit of a Django newbie what I write reflects my simple understanding of what's supposed to happen -- I could have misunderstood something entirely, in which case I apologize.

comment:4 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [14533]) Fixed #14524, #14582, #14617, #14665 and #14667 -- Tweaked staticfiles app.

  • Updated StaticFilesHandler and AdminMediaHandler to make use of the 404 handler if needed.
  • Updated runserver management command to serve static files only in DEBUG mode (or if specified the --insecure option) and if the staticfiles app is in INSTALLED_APPS. Also added an option to disable serving completely (--nostatic).
  • Added check in debug mode if STATICFILES_* settings are different to MEDIA_* settings.
  • Removed a faulty PendingDeprecationWarning in AdminMediaHandler that is triggered every time runserver is used.
  • Fixed an issue with the modification time checks when running collectstatic.
  • Extended and refined documentation.

Thanks to everyone for input, especially to Carl Meyer, Ted Kaemming and
Adam Vandenberg for patches.

comment:3 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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