mod_python and Internal Server Error ...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Julien Cigar

    mod_python and Internal Server Error ...

    Hello,

    I'm using mod_python 3.1.3 with Apache 2.0.54 on a Debian box with the
    publisher handler and the Clearsilver template engine, and from time to
    time apache returns an 500 error code (Internal Server Error).
    Apache errog.log file looks like :

    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publ isher: Traceback (most recent call last):
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publ isher: File
    "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 299, in
    HandlerDispatch \n result = object(req)
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publ isher: File
    "/usr/lib/python2.3/site-packages/mod_python/publisher.py", line 98, in
    handler\n path=[path])
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publ isher: File
    "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 454, in
    import_module\n f, p, d = imp.find_module (parts[i], path)
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publ isher: ImportError: No module named taxal

    ....

    What is strange is that when I reload the page, it's displayed fine, but
    from time to time I get 500 error code ... which is quite annoying ...

    As I'm using the publisher handler, my index.py looks like :

    import sys
    import os.path
    import neo_cgi
    import neo_util
    import neo_cs

    from mod_python import util, apache
    from psycopg import QuotedString

    config = apache.import_m odule('config', autoreload = 0, log = 0)
    utils = apache.import_m odule('utils', autoreload = 0, log = 0)
    specimen = apache.import_m odule('specimen ', autoreload = 0, log = 0)
    taxon = apache.import_m odule('taxon', autoreload = 0, log = 0)
    fulltextsearch = apache.import_m odule('fulltext search', autoreload = 0,
    log = 0)

    template_direct ory = config.getTempl ateDirectory()
    template_main = config.getTempl ateMain()
    template_menu = config.getTempl ateMenu()

    def index(req):
    return home(req)

    def home(req):
    return _render(req, 'home')

    def links(req):
    return _render(req, 'links')

    def contact(req):
    return _render(req, 'contact')

    def taxal(req):
    sort = req.form.getfir st('sort')
    order = req.form.getfir st('order')

    tl = taxon.taxon()
    tl.getTaxaList( sort, order)
    hdf = tl.getHDF()
    return _render(req, 'taxalist', hdf)

    (...)

    So for the above example if I GET http://b.abc.be/birds/taxal it should
    run the "def taxal(req)" function ... I don't understand why I get a
    "mod_python.pub lisher: ImportError: No module named taxal" error message
    in the apache logfile.

    We have several virtualhosts : a.abc.be, b.abc.be, c.abc.be, ...
    (fictive addresses). Our www directory is organized like this :
    /var/www/vhosts/a.abc.be/
    /var/www/vhosts/b.abc.be/
    /var/www/vhosts/b.abc.be/enbi/
    /var/www/vhosts/b.abc.be/enbi/projects/birds/
    /var/www/vhosts/b.abc.be/enbi/projects/butterfly/
    /var/www/vhosts/b.abc.be/enbi/projects/rubiaceae/
    /var/www/vhosts/c.abc.be/blah/

    I've tried with "PythonInterpPe rDirectory on" in my .htaccess, but
    without success ...

    In advance thanks for your support


Working...