0

Django-pipeline 1.5.1およびPython 3.4でDjango 1.8.2を使用しています

このツールの作成者が提供するインストール手順に従いました。提供された開発サーバーを備えたローカル マシンでは、すべて正常に動作します。しかし、mod_wsgi4.4.13 を使用して Apache2 を実行している運用サーバーにデプロイしようとすると、次のエラーが発生します。

SyntaxError at /
invalid syntax (_base.py, line 355)

Error during template rendering

In template /var/www/django/templates/base.html, error at line 13

invalid syntax

12      {% load pipeline %}
13            
          {% stylesheet 'vendor' %}

14      {% stylesheet 'master' %}
15      {% javascript 'vendor' %}
16      {% javascript 'master' %}

明らかに、Apache はキーワードで何をすべきかを知りませんstylesheet。サイトは以前はうまく機能していたと言わざるを得ません。しかし、django-pipeline を使用すると、このエラーが発生します。

私のパイプライン構成は次のようになります。

settings.py

DEBUG = True

INSTALLED_APPS = (
    'pipeline',
    ...
)

MIDDLEWARE_CLASSES = (
    'pipeline.middleware.MinifyHTMLMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'pipeline.finders.PipelineFinder',
)

PIPELINE_COMPILERS = (
  'pipeline.compilers.sass.SASSCompiler',
)

PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'

PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'

PIPELINE_CSS = {
  'master': {
    'source_filenames': (
      'css/*.sass',
    ),
    'output_filename': 'compressed/master.css',
    'extra_context': {
      'media': 'screen, projection',
    },
  },
  'vendor': {
    'source_filenames': (
      'assets/bootstrap/css/bootstrap.min.css',
      'assets/bootstrap/css/bootstrap-theme.min.css',
      'assets/bootswatch/bootswatch.min.css',
    ),
    'output_filename': 'compressed/vendor.css'
  }
}

PIPELINE_JS = {
  'master': {
    'source_filenames': (
      'js/*.js',
    ),
    'output_filename': 'compressed/master.js'
  },
  'vendor': {
    'source_filenames': (
      'assets/jquery/jquery.min.js',
      'assets/bootstrap/js/bootstrap.min.js',
    ),
    'output_filename': 'compressed/vendor.js'
  }
}

私の問題は、django-pipeline が適切にインストールおよび構成されていると確信しているのですが、実稼働サーバーでこのエラーが発生することです。

css および js ファイルの圧縮と提供は、ローカル マシン上で適切に機能します。したがって、django-pipeline の設定を大幅に間違えることはありません。

本番サーバー

  • Ubuntu 14.04
  • 最新のアパッチ 2.4.7
  • パイソン3.4
  • Django と Virtualenv にインストールされたすべてのアプリ
  • mod_wsgi 4.4.13

バーチャルホストからの抜粋

WSGIDaemonProcess django python-path=/var/www/django:/usr/local/share/virtualenvs/django/lib/python3.4/site-packages
WSGIProcessGroup django
WSGIScriptAlias /django /var/www/django/core/wsgi.py
WSGISocketPrefix /var/run/apache2/wsgi

この問題を解決する方法はありますか?ありがとうございました!

4

0 に答える 0