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 #3452

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Guanchishan
Copy link
Contributor

@Guanchishan Guanchishan commented Oct 11, 2024

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.

What type of Pull Request is this?

  • Bug Fix
  • Enhancement
  • Plumbing / Internals / Dependencies
  • Refactor

Does this PR change settings or dependencies, or break something?

  • This PR changes or adds default settings, configuration, or .env values
  • This PR changes or adds dependencies
  • This PR introduces other breaking changes

Details of breaking or configuration changes (if any of above checked)

Documentation

  • New or amended documentation will be required if this PR is merged
  • I have created a matching pull request in the Documentation repository
  • I intend to create a matching pull request in the Documentation repository after this PR is merged

Tests

  • My changes do not need new tests
  • All tests I have added are passing
  • I have written tests but need help to make them pass
  • I have not written tests and need help to write them

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