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

Add STATIC_ROOT to .env.example to fix CSS loading issues #3450

Closed

Conversation

Guanchishan
Copy link
Contributor

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 proper STATIC_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 using collectstatic.

  • 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.

Added STATIC_ROOT=static/ to .env.example file.

This change is necessary to ensure that the static files, such as CSS, load correctly in both logged-in and logged-out states. Previously, the lack of this configuration could lead to missing or broken CSS, affecting the website's usability.
Add STATIC_ROOT to .env.example to fix CSS loading issues
@Guanchishan Guanchishan changed the base branch from production to main October 11, 2024 11:24
@Guanchishan Guanchishan changed the base branch from main to production October 11, 2024 11:24
@Guanchishan
Copy link
Contributor Author

Change into #3452 and close this PR

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.

1 participant