Opened 13 months ago
Last modified 13 months ago
#34929 closed Bug
Issue with Django 3.2 and Django-storage 1.14.2 after Upgrading from Django 2.2.28 — at Version 2
Reported by: | Akash Ilangovan | Owned by: | nobody |
---|---|---|---|
Component: | Utilities | Version: | 3.2 |
Severity: | Normal | Keywords: | static files, ManifestStaticFilesStorage |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
- Upgraded from Django 2.2.28 to 3.2.
- Using Django-storage 1.14.2.
- Replaced CachedFilesMixin with ManifestStaticFilesStorage.
- Post-upgrade, everything was the same; no other settings changed.
- Issue: self.location is caching a None value that doesn't alter.
- Temporary Fix: Deleting the cache in the debugger manually with a del statement resolves the issue.
Code Snippet:
class StaticFilesStorage(ManifestStaticFilesStorage, S3Boto3Storage): def __init__(self, *args, **kwargs): S3Boto3Storage.__init__(self, bucket_name=settings.STATIC_FILES_BUCKET, custom_domain=domain(settings.STATIC_URL), *args, **kwargs) ManifestStaticFilesStorage.__init__(self, *args, **kwargs)
Error output:
File /usr/local/lib/python3.8/dist-packages/django/contrib/staticfiles/storage.py:38, in StaticFilesStorage.path(self, name) 36 def path(self, name): 37 if not self.location: ---> 38 raise ImproperlyConfigured("You're using the staticfiles app " 39 "without having set the STATIC_ROOT " 40 "setting to a filesystem path.") 41 return super().path(name) ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
PDB output showing cached None value in self.location:
(Pdb) self.base_location 'tmp/vantage/static/' (Pdb) self.location '' (Pdb) os.path.abspath(self.base_location) '/app/tmp/vantage/static' (Pdb) del self.location (Pdb) self.location '/app/tmp/vantage/static' (Pdb) self._location 'tmp/vantage/static/' (Pdb) c
The error is resolved after manually refreshing the cache on self.location
Change History (2)
comment:1 by , 13 months ago
Description: | modified (diff) |
---|
comment:2 by , 13 months ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.