I am using Django 1.8.2 with django-pipeline 1.5.1 and Python 3.4
I followed the installation instructions provided by the authors of this tool. On my local machine with the provided development server, everything works fine. But when I try to deploy it on the production server running Apache2 with mod_wsgi4.4.13, I get this error:
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' %}
Obviously, Apache does not know what to do with the keyword stylesheet
. Have to say, that the site was previously running great. But with django-pipeline I get this error.
My pipeline configuration looks like this:
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'
}
}
My problem is, that I am convinced to have django-pipeline properly installed and configured, but on my production server I get this error.
Compressing and serving the css and js files works properly on the local maschine. Therefore django-pipeline cannot be heavily misconfigured.
Production Server
- Ubuntu 14.04
- Latest Apache 2.4.7
- Python 3.4
- Django and all apps installed in a Virtualenv
- mod_wsgi 4.4.13
Excerpt from Virtualhost
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
Do you have any ideas how to solve this issue? Thank you!