Opened 4 weeks ago

Closed 4 weeks ago

#36968 closed Cleanup/optimization (fixed)

Provide better error messages when collectstatic can't find a file referenced in another file

Reported by: blighj Owned by: blighj
Component: contrib.staticfiles Version: 6.0
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At present when ManifestStaticFilesStorage finds a reference within a file to another file that does not exist in the static files. It throws an error that causes confusion. For example https://code.djangoproject.com/ticket/21080#comment:43
Whilenoise has already got a nice pattern to provide a clearer reason to the user so they can fix the issue easily.

The {ext} file '{filename}' references a file which could not be found:
{missing}
Please check the URL references in this {ext} file, particularly any
relative paths which might be pointing to the wrong location.

Change History (7)

comment:1 by Jacob Walls, 4 weeks ago

Triage Stage: UnreviewedAccepted

A thousand times, "yes"!

comment:2 by blighj, 4 weeks ago

Owner: set to blighj
Status: newassigned

comment:3 by blighj, 4 weeks ago

Has patch: set

I've added a PR with the wording

'{filename}' contains a URL '{matched_url}' on line [X or contents of line if short]

The storage resolved the url to {path/to/missing.file} and could not find that file.

Feedback welcome

Last edited 4 weeks ago by blighj (previous) (diff)

comment:4 by Jacob Walls, 4 weeks ago

Patch needs improvement: set

comment:5 by blighj, 4 weeks ago

Patch needs improvement: unset

comment:6 by Jacob Walls, 4 weeks ago

Triage Stage: AcceptedReady for checkin

comment:7 by Jacob Walls <jacobtylerwalls@…>, 4 weeks ago

Resolution: fixed
Status: assignedclosed

In 864850b:

Fixed #36968 -- Improved error message when collectstatic can't find a referenced file.

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