Django Pipeline - 模板渲染期间出错 - 语法无效

时间:2015-07-10 08:53:56

标签: python django django-pipeline

我正在使用Django 1.8.2与django-pipeline 1.5.1和Python 3.4

我按照此工具的作者提供的安装说明进行操作。在我提供的开发服务器的本地机器上,一切正常。但是当我尝试使用mod_wsgi4.4.13在运行Apache2的生产服务器上部署它时,我收到此错误:

stylesheet

显然,Apache不知道如何处理关键字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我得到了这个错误。

我的管道配置如下所示:

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

我的问题是,我确信django-pipeline已正确安装和配置,但在我的生产服务器上出现此错误。

压缩和提供css和js文件在本地maschine上正常工作。因此,django-pipeline不能严重错误配置。

生产服务器

  • Ubuntu 14.04
  • 最新的Apache 2.4.7
  • Python 3.4
  • Django和Virtualenv中安装的所有应用程序
  • mod_wsgi 4.4.13

摘自Virtualhost

file = open("file", "r")

array = file.readlines()

stats = [1, 1, 1, 1, 1] # creating an array to fill

print array

sh1 = array[1] # breaking the array extracted from the text file up for editing

sh2 = array[2]

sh3 = array[3]

sh4 = array[4]

stats[0] = string.rstrip(sh1[1])

stats[1] = string.rstrip(sh2[1])

stats[2] = string.rstrip(sh3[1])


stats[3] = string.rstrip(sh4[1])

print stats

您对如何解决此问题有任何想法吗?谢谢!

0 个答案:

没有答案