There are two options to configure the Publisher handler.
SetHandler directive
This will be used in this tutorial. If you want to follow it exactly use it
yourserf and avoid plenty of confusion. In this configuration all files in a
directory will be handled by the Publisher. <Directory /path/to/publisher/directory>
SetHandler mod_python
PythonHandler mod_python.publisher
PythonDebug On
</Directory>
The lines above must be included in the Apache httpd.conf
file or in the .htaccess file. The <Directory> directive must not be used inside the .htacces file. Instead use only the three internal
lines.
The first line, SetHandler mod_python, tells Apache
that all the files in that directory will be handled by mod_python, regardless
of the file extension.
The second line, PythonHandler mod_python.publisher,
is a mod_python directive. The mod_python handler to be used here is the
Publisher.
The third line, PythonDebug On, sets mod_python to
send error messages to the standard output, quite convenient for debugging.
Should be deleted when in production.
This configuration will be used in the next pages. It enables a traversal
algorithm a bit more convenient than the configuration shown next. That is, it
allows the index page of the site to be executed when no page is declared in the
URL as in http://mysite.tld. Also there is no need to
write the .py extension.
If there is the need to serve static files from the same directory add
this: <Files ~ "\.(gif|html|jpg|png)$">
SetHandler default-handler
</Files>
AddHandler directive
The second option to configure the Publisher handler is changing the SetHandler directive to: AddHandler mod_python .py
With this directive all other file types will be handled by their default
handlers without the need to set them. But it will be necessary to use the .py extension in the URIs. |