[mod_python] Apache1.3.33 + Python2.3.4 + mod_python - Can't get Python templates to work

Graham Dumpleton grahamd at dscpl.com.au
Wed Jan 26 15:55:34 EST 2005


On 27/01/2005, at 2:37 AM, Brandon Masterson wrote:

> from simpletal import simpleTAL, simpleTALES
> import sys
> import os
>
> def index(req):
>    filepath = "%s/basic.html" % os.path.dirname(__file__)
>    templateFile = open (filepath, 'r')
>    templateFile.close()
>
> This gets me this error when I used 
> "http://192.168.0.12/pythontest/a.py" :
> 500 Internal Server Error
> The server encountered an internal error or misconfiguration and was 
> unable to complete your request.

If there was a problem with the import of TAL stuff, with PythonDebug 
enabled,
one would normally get a traceback displayed in the browser.

In my experience, a 500 error of this form has usually meant an error 
in the
config files. If other requests in the same directory are still working 
then
it is perhaps something more sinister. If other requests in the same 
directory
aren't working either but normal requests in other directories are, then
possibly a config problem in the local .htaccess file. Ar you using a 
.htaccess
file at all?

You have posted the full httpd.conf file which can at least look at. 
Although
when I said about posting the config, I sort of mean't just the 
Directory
directive block relevant to that directory from httpd.conf, or whatever 
you
have in the local .htaccess file.

BTW, the more sinister sort of thing that can happen is something like 
shared
library version clashes between Python modules, Apache, PHP and Perl 
for stuff
like expat library. Comes up quite a bit.

As Nicolas said, remove the TAL stuff first at least as that will 
eliminate
the possibility of a shared library problem if it happens to require 
expat.

Graham



More information about the Mod_python mailing list