Created
November 1, 2011 17:17
-
-
Save bruth/1331232 to your computer and use it in GitHub Desktop.
Django staticfiles storage and finder classes for apps to copy static files into their own directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add: | |
# | |
# STATICFILES_FINDERS = ( | |
# 'path.to.this.module.PrefixedAppDirectoriesFinder', | |
# ... | |
# ) | |
from django.contrib.staticfiles.finders import AppDirectoriesFinder | |
from django.contrib.staticfiles.storage import AppStaticStorage | |
class PrefixedAppStaticStorage(AppStaticStorage): | |
def __init__(self, app, *args, **kwargs): | |
self.prefix = app | |
super(PrefixedAppStaticStorage, self).__init__(app, *args, **kwargs) | |
class PrefixedAppDirectoriesFinder(AppDirectoriesFinder): | |
storage_class = PrefixedAppStaticStorage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment