Add STATIC_ROOT to .env.example to fix CSS loading issues #3452
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
This pull request adds
STATIC_ROOT=static/
to the.env.example
file to prevent CSS and other static resources from not loading properly. Specifically, this change addresses an issue where, without a properSTATIC_ROOT
configuration, the website's CSS fails to load correctly, especially after logging in. This causes a poor user experience as stylesheets are missing or not applied.Technical Details:
Added
STATIC_ROOT=static/
to.env.example
.Ensured that the static files are properly collected into the
static/
directory usingcollectstatic
.This adjustment complements existing Nginx configurations, ensuring that both static and media files are accessible.
Additional context:
I recently migrated my service to the current environment, and I ensured that all recommended update procedures outlined in the BookWyrm documentation were strictly followed.
Initially, after properly configuring Nginx, the CSS for the site appeared normal for users who were not logged in. However, upon logging in, the CSS became disorganized. This issue was only resolved after configuring STATIC_ROOT=static/.
Interestingly, although this was not directly related to the issue, I also found that after configuring Nginx, other images on the website displayed correctly, but the site icon did not appear. It was only after adding MEDIA_ROOT=images/ that the site icon became visible. This was an intriguing discovery.
What type of Pull Request is this?
Does this PR change settings or dependencies, or break something?
Details of breaking or configuration changes (if any of above checked)
Documentation
Tests