fastCGI+mod_python

If you will use PyLucid with fastCGI or modPython you need a external WSGI Handler!

You can use flup, download it from:

or use the SVN Version:

fastCGI

Download flup and copy flup into PyLucid on your Server. It must look then in such a way:

.\colubrid
.\flup
.\flup\client
.\flup\middleware
.\flup\resolver
.\flup\server
.\jinja
.\pygments
.\PyLucid
.\tests
.\wsgiref

Make a dispatcher file, named like 'index.fcgi', in the PyLucid root dir:

Test CGI-file

import cgi

import sys, os

def app(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])

    yield '<h1>FastCGI Environment</h1>'

    yield '<table>'

    for key, value in sorted(environ.items()):
        yield '<tr><th>%s</th><td>%s</td></tr>' % (
            cgi.escape(key), cgi.escape(value)
        )

    yield '</table>'

Mark the dispatcher file out executably: chmod 755 index.fcgi. Only this file must have execute rights! Request this file in your browser...

mod_python

Note: : we have not tested PyLucid enought with mod_python so it is experimental

To use PyLucid with mod_python you'll need a mod_python Handler. You can find one in the repository of www.pocoo.org : mod_python Handler Or the other one at projects.armor.org.

Both have a good dokumentation and won't be maintained from PyLucid Team!

So if you've downloaded one mod_python Handler ( I'll use modpywsgi.py in this example ) you need to copy it into you site-pakages so mod_python can find it.

now you have to add some lines to you Apache-Config. If you use virtual hosts it can look something like that:

<VirtualHost 88.198.26.9>
        ServerAdmin webmaster@yourdomain.xy
        DocumentRoot /path/to/root/path
        ServerName www.your-domain.xy
        <Location /path>
                AddHandler mod_python .py

                # define the PythonHandler ( modpywsgi )
                PythonHandler modpywsgi::handler
                PythonAutoReload On
                # You can use the values 'On' or 'Off'

                # if pylucid isn't in sys.path
                PythonPath "['path/to/pylcid'] + sys.path"

                # this should link to PyLucid_app.py
                PythonOption application PyLcid_app::app

                # only use it for development! values: 'On' or 'Off'
                PythonDebug On
        </Location>
</VirtualHost>

Please note that we havn't compleated all work to make PyLucid compatible with mod_python! For example are there a few errors with install PyLucid with mod_python!