Skip to content

Instantly share code, notes, and snippets.

@jezdez
Created December 28, 2010 12:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jezdez/757166 to your computer and use it in GitHub Desktop.
Save jezdez/757166 to your computer and use it in GitHub Desktop.
support for legacy locations of app media (in APP/media/)
# Add this to your settings.py
STATICFILES_FINDERS += (
'mysite.finders.AppMediaFinder'
)
##########################################################################################
#
# OMFG -- DON'T SHIP THIS WITH YOUR REUSABLE APP, SINCE IT WON'T BE REUSABLE ANYMORE.
#
##########################################################################################
from django.contrib.staticfiles.finders import AppDirectoriesFinder
from django.contrib.staticfiles.storage import AppStaticStorage
class LegacyAppStaticStorage(AppStaticStorage):
source_dir = 'media'
class AppMediaFinder(AppDirectoriesFinder):
storage_class = LegacyAppStaticStorage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment