3

django-pipeline を django アプリケーションにインストールしましたが、JavaScript ファイルが圧縮されていないようです。テンプレートタグが正常に動作しているため、正しくインストールされているようです。ファイルを圧縮するために manage.py collectstatic を使用しています。これが私の現在の構成です。また、Django 1.3 を使用しているため、django-pipeline ドキュメントに従って django-staticfiles を使用するようにアプリをセットアップしました。

 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',
    }
 }

ここで何が欠けているのかわかりませんが、何かがあると確信しています。エラーメッセージなどは表示されません。圧縮されていないだけです。

ご協力いただきありがとうございます!

4

2 に答える 2

1

静的ファイルを次のように設定しましたか:

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

そうであれば :

  • jsファイルは最終的に空になりますか?

  • '/Applications/yuicompressor-2.4.7/build/yuicompress'実行可能なスクリプトですか?

于 2012-04-18T13:38:51.307 に答える
1

DEBUG=True設定に入りましたか?PIPELINE=True追加して、圧縮が実行されることを確認してください

于 2012-04-18T08:06:03.877 に答える