-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More helpful error when STATIC_ROOT lacks prefix
Thanks to @dominicrodger for reporting. Closes #36
- Loading branch information
Showing
1 changed file
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c8518b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the STATIC_URL prefix necessary?
c8518b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't absolutely necessary, but it's enforced for two reasons:
STATIC_URL
and, as WhiteNoise strips the hostname from the URL, if you don't have a prefix you end up with the equivalent of an emptySTATIC_URL
.c8518b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the intent, but the error message was pretty unhelpful. Do you mean "must include a path component" rather than "must include a url prefix" ? Or better yet, show the before vs after rather than just the suggested STATIC_URL. I apparently was misconfigured, and assumed all along I had the '/static/' path in my static_url, so I was going nuts trying to figure out what was wrong with my configuration.
c8518b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@blalger Good point, thanks: "prefix" is the internal terminology, "path component" is obviously the right phrase to use in the error message; I'll change that.
I'll think about the before vs after values in the error message, but my feeling is that if people are confused about how their own settings are configured then it's hard for an error message to convince them otherwise. And, generally speaking, the more text you put in the message the less clear people find it.