|
2 | 2 |
|
3 | 3 | from io import BytesIO
|
4 | 4 |
|
5 |
| -from django.contrib.staticfiles.storage import CachedStaticFilesStorage, ManifestStaticFilesStorage, StaticFilesStorage |
| 5 | +import django |
| 6 | + |
| 7 | +_CACHED_STATIC_FILES_STORAGE_AVAILABLE = django.VERSION[0] <= 3 and django.VERSION[1] < 1 |
| 8 | + |
| 9 | +if _CACHED_STATIC_FILES_STORAGE_AVAILABLE: |
| 10 | + from django.contrib.staticfiles.storage import CachedStaticFilesStorage |
| 11 | +from django.contrib.staticfiles.storage import ManifestStaticFilesStorage, StaticFilesStorage |
6 | 12 | from django.contrib.staticfiles.utils import matches_patterns
|
7 | 13 |
|
8 | 14 | from django.core.files.base import File
|
@@ -90,14 +96,17 @@ class NonPackagingPipelineStorage(NonPackagingMixin, PipelineStorage):
|
90 | 96 | pass
|
91 | 97 |
|
92 | 98 |
|
93 |
| -class PipelineCachedStorage(PipelineMixin, CachedStaticFilesStorage): |
94 |
| - # Deprecated since Django 2.2 |
95 |
| - pass |
| 99 | +if _CACHED_STATIC_FILES_STORAGE_AVAILABLE: |
| 100 | + class PipelineCachedStorage(PipelineMixin, CachedStaticFilesStorage): |
| 101 | + # Deprecated since Django 2.2 |
| 102 | + # Removed in Django 3.1 |
| 103 | + pass |
96 | 104 |
|
97 | 105 |
|
98 |
| -class NonPackagingPipelineCachedStorage(NonPackagingMixin, PipelineCachedStorage): |
99 |
| - # Deprecated since Django 2.2 |
100 |
| - pass |
| 106 | + class NonPackagingPipelineCachedStorage(NonPackagingMixin, PipelineCachedStorage): |
| 107 | + # Deprecated since Django 2.2 |
| 108 | + # Removed in Django 3.1 |
| 109 | + pass |
101 | 110 |
|
102 | 111 |
|
103 | 112 | class PipelineManifestStorage(PipelineMixin, ManifestStaticFilesStorage):
|
|
0 commit comments