Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nice 404 error message #366

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Nice 404 error message #366

wants to merge 3 commits into from

Conversation

boxed
Copy link

@boxed boxed commented Feb 13, 2022

Hi,

I help beginners a lot on the Unofficial Django Discord, and a very common problem is various problems with static files. I always ask them to install whitenoise obviously, but then I realized that whitenoise doesn't have great error messages for when they have other problems than just "set DEBUG=False" :P

This patch will make the error message much more informative and should help beginners a lot when trying to figure out why their static files don't work.

(This is sort of related to my other work with django-fastdev but this specific change made more sense in whitenoise I thought)

Copy link
Collaborator

@adamchainz adamchainz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I like the idea of adding an error message. This doesn't seem like the right approach to me though. whitenoise/base.py is completely generic for use with any WSGI app. So nothing Django related can occur in that file.

If you can come up with an approach that is either generic or restricted to the Django related files, that would be good. Please also add test coverage, and a changelog note (and possibly documentation if necessary e.g. to note caveats).

@boxed
Copy link
Author

boxed commented Feb 14, 2022

Aha. I didn't know that. I will rethink this.

@boxed
Copy link
Author

boxed commented Feb 19, 2022

I've redone this so it applies to django only. I couldn't really understand how I'd do it in a more generic way.

There are now tests, and a changelog entry.

Not sure what you want from the docs? It doesn't seem like it's a thing that needs documentation per se.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants