[mod_python] simpleTAL - 500 Internal Server Error

Julien Cigar jcigar at ulb.ac.be
Wed Oct 12 03:24:13 EDT 2005


I suggest that you first try with multiple interpreters (with the 
PythonInterpPerDirectory On for example). I had a lot of "Internal 
Server Error" before, and the problem comes from that.
I don't know TAL but I had a similar problem with the Clearsilver 
template engine (and multiple interpreters).
With clearsilver I had to run the neo_cgi.update() after importing 
neo_cgi, from the documentation :

    This is only necessary in PyApache in non-single Python interpreter
    mode. If you are using an embedded Python interpreter which
    continues to be reloaded every page, then update reinstalls the
    "fake" modules neo_util, and neo_cs. This is necessary because on
    interpreter restart the modules are kept loaded, but their init
    functions are not re-run.

maybe you have to do something like that with TAL too ...


Erdi Balint wrote:

> Hi all,
> I'm trying to use simpleTAL templates with no success. When querying 
> the python script that expands the template I get the following:
> "Internal Server Error
> The server encountered an internal error or misconfiguration and was 
> unable to complete your request.
> Please contact the server administrator, webmaster at localhost and 
> inform them of the time the error occurred, and anything you might 
> have done that may have caused the error.
> More information about this error may be available in the server error 
> log."
> Apache/1.3.33 Server at localhost Port 80
> The apache error log is not verbose and does not contain a stack 
> trace, only this:
> [Wed Oct 12 08:42:37 2005] [notice] mod_python: (Re)importing 
> mod_python.publisher from None
> [Wed Oct 12 08:42:37 2005] [notice] mod_python: (Re)importing simple 
> from ['/var/www/helloSimpleTAL/control']
> My code:
> import sys
> from simpletal import simpleTAL, simpleTALES
> ------
> def hello(req):
>     # Create the context that is used by the template
>     context = simpleTALES.Context()
>     context.addGlobal ("title", "Hello World")
>     templateFile = open ("/var/www/helloSimpleTAL/simple.html", 'r')
>     template = simpleTAL.compileHTMLTemplate (templateFile)
>     templateFile.close()
>     template.expand (context, sys.stdout)
>     # (1)
> -----
> My Directory directive in apache:
> <Directory /var/www/helloSimpleTAL/control>
>         SetHandler python-program
>         PythonHandler mod_python.publisher
>         PythonDebug on
> </Directory>
> I've found someone had the same problem before on this mailing list 
> and got answered that this is a bug in mod_python 2.7.10, so I added a
> return " " to (1) above, but that only returned an empty page (and if 
> I do return "x", a page with an 'x' will be rendered)
> I'm using Python 2.3.4, Apache 1.3.33, mod_python 2.7.11 and I've got 
> the publisher handler to work beforehand, just not with simpleTAL :(
> Can anyone help me with this?
> Thanks a lot in advance,
> Balint
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list