问题
I have just installed django-pipeline into my django application and it doesn't seem to be compressing my javascript files. It seems to be installed properly as the template tags are working correctly. I'm using manage.py collectstatic in order to compress the files. Here is my current configuration. I have also set up my app to use django-staticfiles per the django-pipeline docs as I'm using Django 1.3.
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'site_media', 'static')
STATIC_URL = '/site_media/static/'
ADMIN_MEDIA_PREFIX = '/site_media/static/admin/'
STATICFILES_DIRS = (
os.path.join(PROJECT_ROOT, "media"),
)
STATICFILES_FINDERS = (
##Turn these on if using django.contrib.staticfiles
##'django.contrib.staticfiles.finders.FileSystemFinder',
##'django.contrib.staticfiles.finders.AppDirectoriesFinder',
##'django.contrib.staticfiles.finders.DefaultStorageFinder',
##Turn these on if using django.contrib.staticfiles
'staticfiles.finders.FileSystemFinder',
'staticfiles.finders.AppDirectoriesFinder',
'staticfiles.finders.DefaultStorageFinder'
)
PREREQ_APPS = [
# Django
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
#External
'south',
'staticfiles',
'pipeline',
]
PIPELINE_YUI_BINARY='/Applications/yuicompressor-2.4.7/build/yuicompress'
PIPELINE_JS = {
'site': {
'source_filenames': (
'js/libs/ddsmoothmenu.js',
'js/script.js',
),
'output_filename': 'js/script.min.js',
}
}
I'm not sure what I'm missing here, but I'm sure it is something. I am not getting any error messages or anything, it just isn't compressing.
Thanks for your help!
回答1:
Did you setup staticfiles with :
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
If yes :
Are you js files eventually empty ?
Is
'/Applications/yuicompressor-2.4.7/build/yuicompress'
an executable script ?
回答2:
Have you got DEBUG=True
in your settings? Try adding PIPELINE=True to make sure it runs the compressions
来源:https://stackoverflow.com/questions/10202082/django-pipeline-not-compressing