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

Brandon Masterson bmasters at direcway.com
Thu Jan 27 01:42:40 EST 2005


Commented out as requested and got the same 500 error message below:

    500 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 Knoppix 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 192.168.0.12 Port 80

How I called it: http://192.168.0.12/pythontest/a.py

Did it 3 times in a row and this is what the error log showed:

[Wed Jan 26 22:36:20 2005] [notice] mod_python: (Re)importing a from 
['/var/www/pythontest']
[Wed Jan 26 22:36:21 2005] [notice] mod_python: (Re)importing a from 
['/var/www/pythontest']
[Wed Jan 26 22:36:22 2005] [notice] mod_python: (Re)importing a from 
['/var/www/pythontest']

EXAMPLE 1
--------------------------------------------------------------------------------------------------------------------------------------------
Okay, so here's a simple script that I believe demos things are working:

from mod_python import util
from mod_python import apache
import os

def hello(name=None):
      if name:
          return 'Hello, %s!' % name.capitalize()
      else:
          return 'Hello there! %s ' % os.path.dirname(__file__)

PRODUCES ON THE BROWSER:
Hello there! /var/www/pythontest


EXAMPLE 2
--------------------------------------------------------------------------------------------------------------------------------------------
Okay, here's a simple script that I believe demos things are working:

from mod_python import util
from mod_python import apache
import os

def page(req):
      req.content_type = 'text/html'
      req.write('<html><head><title>Available Projects</title></head>')
      req.write('<body><h1>Available Projects</h1><ul>')
      req.write('Processing ')
      req.write('</ul></body><html>')

PRODUCES ON THE BROWSER:

Available Projects

       Processing

HTTP/1.1 500 Internal Server Error Date: Thu, 27 Jan 2005 04:37:26 GMT 
Server: Apache/1.3.33 (Debian GNU/Linux) mod_python/2.7.10 Python/2.3.4 
PHP/4.3.8-5 mod_ssl/2.8.22 OpenSSL/0.9.7d Connection: close 
Transfer-Encoding: chunked Content-Type: text/html; charset=iso-8859-1 252
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 Knoppix 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 192.168.0.12 Port 80
0

ERROR LOG:
[Wed Jan 26 23:37:26 2005] [notice] mod_python: (Re)importing h from 
['/var/www/pythontest']




More information about the Mod_python mailing list