Created
March 27, 2013 09:54
-
-
Save toudi/5253106 to your computer and use it in GitHub Desktop.
staticfiles finder which allows you to use STATIC_ROOT for hosting static files on development server
This file contains 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
from django.contrib.staticfiles.finders import DefaultStorageFinder | |
from django.conf import settings | |
from django.core.files.storage import FileSystemStorage | |
class StaticRootFinder(DefaultStorageFinder): | |
def __init__(self, *args, **kwargs): | |
self.storage = FileSystemStorage(location=settings.STATIC_ROOT, base_url=settings.STATIC_URL) | |
super(StaticRootFinder, self).__init__(*args, **kwargs) | |
# settings.py: | |
# STATICFILES_FINDERS = ( | |
# 'django.contrib.staticfiles.finders.AppDirectoriesFinder', | |
# 'path.to.finders.StaticRootFinder' | |
# ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment