I'm trying to setup Apache to apply a Diazo theme, but it seems that the processing chain halts at some point, producing an empty file, which leads to an error (the error only appears if the line FilterChain THEME
appears in the configuration, so I'm sure it's related to applying the theme).
So far, I have applied the following steps:
First, I compiled my rules.xml with diazocompile to produce a file /home/elmolino/buildout/src/djangolino-theme/theme.xsl
.
Then, I updated my apache configuration file to look like this:
WSGIPythonHome /home/elmolino/buildout/env
LoadModule transform_module /usr/lib/apache2/modules/mod_transform.so
LoadModule filter_module /usr/lib/apache2/modules/mod_filter.so
<VirtualHost *:80>
ServerName elmolino.usecm.com
ServerAdmin [email protected]
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !/wsgi/
RewriteCond %{REQUEST_FILENAME} !/site_media/
RewriteCond %{REQUEST_FILENAME} !/static/
RewriteRule ^(.*)$ /wsgi/django.wsgi/$1 [QSA,PT,L]
LogLevel info
ErrorLog /home/elmolino/buildout/var/error_log
CustomLog /home/elmolino/buildout/var/access_log common
FilterDeclare THEME
FilterProvider THEME XSLT resp=Content-Type $text/html
TransformOptions +ApacheFS +HTML +HideParseErrors
TransformSet /home/elmolino/buildout/src/djangolino-theme/theme.xsl
# TransformCache /home/elmolino/buildout/src/djangolino-theme/theme.xsl /etc/apache2/theme.xsl
# Paths to el molino site
Alias /wsgi/ /home/elmolino/buildout/src/elmolino/apache/
<Directory /home/elmolino/buildout/src/elmolino/apache>
Options ExecCGI
SetHandler wsgi-script
FilterChain THEME
Order allow,deny
Allow from all
AuthType Basic
AuthName "ElMolino FrontEnd"
AuthUserFile /etc/apache2/authorization-users
Require valid-user
</Directory>
# serve media files
Alias /site_media "/home/elmolino/buildout/var/media"
# serve static files
Alias /static "/home/elmolino/buildout/var/static"
</VirtualHost>
When I then try to access the home page of my site, an error "No data received" appears in the browser
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
The error log shows the following messages:
info [client 213.97.51.211] mod_wsgi (pid=32415, process='', application='elmolino.usecm.com|/wsgi/django.wsgi'): Loading WSGI script '/home/elmolino/buildout/src/elmolino/apache/django.wsgi'.
error [client 213.97.51.211] mod_transform::libxml2_error: /home/elmolino/buildout/src/djangolino-theme/theme.xsl:1:
error [client 213.97.51.211] mod_transform::libxml2_error: parser
error [client 213.97.51.211] mod_transform::libxml2_error: error :
error [client 213.97.51.211] mod_transform::libxml2_error: Document is empty\n
error [client 213.97.51.211] mod_transform::libxml2_error: \n
error [client 213.97.51.211] mod_transform::libxml2_error: ^\n
error [client 213.97.51.211] mod_transform::libxml2_error: /home/elmolino/buildout/src/djangolino-theme/theme.xsl:1:
error [client 213.97.51.211] mod_transform::libxml2_error: parser
error [client 213.97.51.211] mod_transform::libxml2_error: error :
error [client 213.97.51.211] mod_transform::libxml2_error: Start tag expected, '<' not found\n
error [client 213.97.51.211] mod_transform::libxml2_error: \n
error [client 213.97.51.211] mod_transform::libxml2_error: ^\n
error [client 213.97.51.211] mod_transform: XSLT: Loading of the XSLT File has failed
Help is really appreciated! Maarten
If I use the TransformCache option, it seems to work. I will write down the things I changed (this solution is based on my current understanding, it may still not be correct). When using TransformCache, the first argument is the name of the cached file (I doubt if it is really used as a file, since no file with this names gets created), and the second argument is the name of the input file. The name of the cache file should be passed to TransformSet: