Fixed #21867 -- Removed AppStaticStorage; app paths are now AppConfig's job.

AppStaticStorage only provided one thing over FileSystemStorage, which was
taking an app name (import path) and translating it into a filesystem
path. This is now something that should be done via app_config.path instead,
leaving AppStaticStorage with no reason for existence. It should be safe to
remove, as it was undocumented internal API.

There was some kind of feature in the AppDirectoriesFinder code related to a
"prefix" attribute on the storage class used by AppDirectoriesFinder. Since
this feature was undocumented, untested, and of unclear purpose, I removed it
as well.
This commit is contained in:
Carl Meyer 2014-01-24 15:32:03 -07:00
parent 06bd181f97
commit f56c88a8ee
3 changed files with 13 additions and 68 deletions

View file

@ -1,7 +1,6 @@
from __future__ import unicode_literals
from collections import OrderedDict
import hashlib
from importlib import import_module
import os
import posixpath
import re
@ -16,7 +15,6 @@ from django.core.files.storage import FileSystemStorage, get_storage_class
from django.utils.encoding import force_bytes, force_text
from django.utils.functional import LazyObject
from django.utils.six.moves.urllib.parse import unquote, urlsplit, urlunsplit, urldefrag
from django.utils._os import upath
from django.contrib.staticfiles.utils import check_settings, matches_patterns
@ -383,25 +381,6 @@ class ManifestStaticFilesStorage(ManifestFilesMixin, StaticFilesStorage):
pass
class AppStaticStorage(FileSystemStorage):
"""
A file system storage backend that takes an app module and works
for the ``static`` directory of it.
"""
prefix = None
source_dir = 'static'
def __init__(self, app, *args, **kwargs):
"""
Returns a static file storage if available in the given app.
"""
# app is the actual app module
mod = import_module(app)
mod_path = os.path.dirname(upath(mod.__file__))
location = os.path.join(mod_path, self.source_dir)
super(AppStaticStorage, self).__init__(location, *args, **kwargs)
class ConfiguredStorage(LazyObject):
def _setup(self):
self._wrapped = get_storage_class(settings.STATICFILES_STORAGE)()