class AppCatalogStorage(FileSystemStorage):
"""
A file system storage backend that takes an app module and works
for the ``catalog`` directory of it.
"""
prefix = None
source_dir = 'catalog' <------- changed, was '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(AppCatalogStorage, self).__init__(location, *args, **kwargs)
STATICFILES_STORAGE = (
'myapp.storage.AppCatalogStorage',
'django.contrib.staticfiles.storage.StaticFilesStorage'
)
My understanding here is that I can then do:
(Assuming my app name is fred)
fred/catalog/js/someJavascript.js
fred/catalog/css/someStylesheet.css
I also assumed they would then be accessible as:
/static/fred/js/someJavascript.js
/static/fred/css/someStylesheet.css
However, neither file is available at the expected URL. Did I misunderstand something?