2

django-pipeline静的アセットを管理し、coffeescript と SCSS ファイルの両方をコンパイルするために使用しています。この Django アプリの構成に問題があります。私が達成したいのはdjango-pipeline、coffeescript と SCSS ファイルを assets/ サブディレクトリから読み取り、それらをコンパイルして public/ サブディレクトリに圧縮し、そこから Django に静的ファイルを提供するように指示したことです。

参考までに、私の Django ファイル構造は次のようになります。

DjangoApp
    assets
        coffeescript
        scss
    bin
    configs
    db
    logs
    DjangoApp
    public
        css
        images
        js
    requirements

私の現在の Django 設定は次のようになります (簡潔にするために無関係なものは省略されています)。

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/var/www/example.com/static/"
STATIC_ROOT = ''

# URL prefix for static files.
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/public/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    PROJECT_PATH + '/public',
)

# Asset compilers.
PIPELINE_COMPILERS = (
    'pipeline.compilers.coffee.CoffeeScriptCompiler',
    'pipeline.compilers.sass.SASSCompiler'
)

PIPELINE_CSS = {
    'ie': {
        'source_filenames': (
            'scss/ie.scss',
        ),
        'output_filename': 'css/ie.min.css'
    },
    'print': {
        'source_filenames': (
            'scss/print.scss',
        ),
        'output_filename': 'css/print.min.css'
    },
    'screen': {
        'source_filenames': (
            'scss/screen.scss',
            'scss/screen-responsive-768px.scss',
            'scss/screen-responsive-992px.scss',
            'scss/screen-responsive-1200px.scss'
        ),
        'output_filename': 'css/screen.min.css'
    }
}

PIPELINE_JS = {
    'application': {
        'source_filenames': (
          'coffeescript/application.coffee',
        ),
        'output_filename': 'js/application.min.js',
    }
}

おそらく、このアプリは私が望むことを行うことができません。他のものを探すべきですか?

4

1 に答える 1

3

私はこれでしばらく遊んでいましたが、運が悪かったです。しかし、私はpython gearsorから欲しかったものを正確に見つけましdjango-gearsた。私が達成したかったことを考えると、Ruby を複製sprocketsすることは完璧です。

于 2013-11-01T17:44:42.460 に答える