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

hotfix for DEBUG=True and USE_SRI=True and ManifestStaticFilesStorage #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sri/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
from pathlib import Path

from django.conf import settings
from django.contrib.staticfiles.finders import find as find_static_file
from django.contrib.staticfiles.storage import staticfiles_storage
from django.core.cache import DEFAULT_CACHE_ALIAS, caches
Expand All @@ -15,7 +16,7 @@ def get_static_path(path: str) -> Path:
Resolves a path commonly passed to `{% static %}` into a filesystem path
"""

if hasattr(staticfiles_storage, "stored_name"):
if (not settings.DEBUG) and hasattr(staticfiles_storage, "stored_name"):
Copy link
Owner

Choose a reason for hiding this comment

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

Question: What about DEBUG is it that changes the behaviour here? Is there a better setting it should be derived from?

path = staticfiles_storage.stored_name(path)

collected_file_path = staticfiles_storage.path(path)
Expand Down