mod_python and Internal Server Error ...

Discussion in 'Python' started by Julien Cigar, Jun 28, 2005.

  1. Julien Cigar

    Julien Cigar Guest

    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.publisher: Traceback (most recent call last):
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publisher: 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.publisher: 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.publisher: File
    "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 454, in
    import_module\n f, p, d = imp.find_module(parts, path)
    [Tue Jun 28 14:42:12 2005] [error] [client 164.x.x.x] PythonHandler
    mod_python.publisher: 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_module('config', autoreload = 0, log = 0)
    utils = apache.import_module('utils', autoreload = 0, log = 0)
    specimen = apache.import_module('specimen', autoreload = 0, log = 0)
    taxon = apache.import_module('taxon', autoreload = 0, log = 0)
    fulltextsearch = apache.import_module('fulltextsearch', autoreload = 0,
    log = 0)

    template_directory = config.getTemplateDirectory()
    template_main = config.getTemplateMain()
    template_menu = config.getTemplateMenu()

    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.getfirst('sort')
    order = req.form.getfirst('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.publisher: 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 "PythonInterpPerDirectory on" in my .htaccess, but
    without success ...

    In advance thanks for your support
     
    Julien Cigar, Jun 28, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Bonds
    Replies:
    2
    Views:
    2,819
    Amaryllis
    Aug 3, 2004
  2. Replies:
    5
    Views:
    80,797
    cpdarkman
    Aug 26, 2009
  3. blbmdsmith
    Replies:
    1
    Views:
    678
    Graham Dumpleton
    Dec 14, 2006
  4. BobbyOwens
    Replies:
    0
    Views:
    4,698
    BobbyOwens
    Jan 23, 2009
  5. Replies:
    0
    Views:
    811
Loading...

Share This Page