fix: serve favicon.ico and robots.txt from WHITENOISE_ROOT #1397
Open
paulschreiber wants to merge 5 commits into
Open
fix: serve favicon.ico and robots.txt from WHITENOISE_ROOT #1397paulschreiber wants to merge 5 commits into
paulschreiber wants to merge 5 commits into
Conversation
370b5b7 to
7ef5867
Compare
harrislapiroff
requested changes
Jul 6, 2026
| STORAGES["staticfiles"] = { | ||
| "BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage", | ||
| } | ||
| WHITENOISE_ROOT = os.path.join(BASE_DIR, "securedrop", "static") |
Contributor
There was a problem hiding this comment.
Ack, I hate to be so nitpicky about this multiple times, but I think this isn't the right solution either for two reasons:
- The result of this is that our javascript files in that directory will now also be served at the root (so
piwik.jswill be available athttps://securedrop.org/static/js/piwik.jsandhttps://securedrop.org/js/piwik.jsand, while I can't think offhand of any problems that would cause, it's at least weird. (It would cause a problem if someone added a folder name that collided with a page URL, e.g., if someone added static files relating to the directory to/securedrop/static/directory/that would cause the directory at https://securedrop.org/directory/ to stop working in a way that might confuse a future dev. This is a bit contrived, since that probably isn't where they would add such files.) - More importantly I think this directory structure kinda muddies the distinction between the files we want to serve at the root and the ones we want to serve under
/static/which could be potentially confusing to a future developer more distant from this change.
I'd suggest either:
- Move favicon and robots to
/securedrop/static/root/and make thisWHITENOISE_ROOT = os.path.join(BASE_DIR, "securedrop", "static", "root"). The root files will still end up getting served twice, but at least the intention will be clear—and polluting the/static/namespace is less high-stakes than polluting the root of the site. - Create a separate directory at
/root_static/or similar and put the files in there and change this toWHITENOISE_ROOT = os.path.join(BASE_DIR, "root_static"). I prefer this solution for minimal ambiguity, but I'm not wedded to it.
zrobert7
approved these changes
Jul 7, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Serve
favicon.icoandrobots.txtfromWHITENOISE_ROOT.Remove old template view for robots.txt
Partially addresses https://github.com/freedomofpress/fpf-www-projects/issues/581
Changes proposed in this pull request:
Type of change