#20634 closed Bug (fixed)
Discrepancy about staticfiles finders strategy
Reported by: | Claude Paroz | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Tutorial 6 says:
Django will choose the first static file it finds whose name matches
https://docs.djangoproject.com/en/dev/intro/tutorial06/#customize-your-app-s-look-and-feel
Static files howto says:
Django will use the last static file it finds whose name matches
https://docs.djangoproject.com/en/dev/howto/static-files/#configuring-static-files
Documentation for STATICFILES_FINDERS could also tell something about this strategy.
https://docs.djangoproject.com/en/dev/ref/contrib/staticfiles/#staticfiles-finders
Attachments (1)
Change History (7)
comment:1 by , 11 years ago
by , 11 years ago
Attachment: | 20634.diff added |
---|
comment:2 by , 11 years ago
Has patch: | set |
---|
comment:3 by , 11 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:4 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:6 by , 11 years ago
This may have been introduced during the last staticfiles docs refactor in February. :-/
The tutorial is the correct one.
It's consistent with the template loaders mechanism: Django goes through each loader and if a match is found, it returns it.
Each loader is then free to implement its own logic, but the default ones work on a "first match returned" basis:
FileSystemFinder
goes through each directory insettings.STATICFILES_DIR
(in order) and returns the first match.AppDirectoriesFinder
goes through each app insettings.INSTALLED_APPS
(in order) and return the first match too.The
collectstatic
command will also only handle the first match. That is, if it finds a static file whose name has already been handled, it skips it.