[mod_python] Permissions issue

Hagop Narsesian hagopnarsesian at yahoo.com
Mon Feb 18 07:13:33 EST 2008


Dear all,
  I have a problem I can't seem to get my head around, I'm hoping this is common enough for someone to have a standard reply! I have a Python-Pygresql-Postgresql-Apache-Mod_python setup and have  aproblem connecting to the postgresql database. I believe this is a mod_python issue specifically because the same code works fine as pure Python code accessing Postgresql through Pygresql.
   
  There is a shopping basket on a pure html page which sends form data to a mod_python coded page and the following error message is received with apache's debug feature on. This identical code worked on a windows system, and the same connection code works fine as a pure Python module on the said machine. In httpd.conf, the user is Apache and the group is Apache.
   
  I've tried every experiment I can think of. Can anyone help?
  Hagop  
   
  MOD_PYTHON ERROR

ProcessId:      891
Interpreter:    '127.0.0.1'

ServerName:     '127.0.0.1'
DocumentRoot:   '/var/www/html'

URI:            '/csp2/cart.py/p1'
Location:       None
Directory:      None
Filename:       '/var/www/html/csp2/cart.py'
PathInfo:       '/p1'

Phase:          'PythonHandler'
Handler:        'mod_python.publisher'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

  File "/usr/lib/python2.5/site-packages/mod_python/publisher.py", line 204, in handler
    module = page_cache[req]

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1059, in __getitem__
    return import_module(req.filename)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 296, in import_module
    log, import_path)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 680, in import_module
    execfile(file, module.__dict__)

  File "/var/www/html/csp2/cart.py", line 3, in <module>
    rs=rsw.rsc()

  File "/var/www/html/csp2/rsw.py", line 7, in __init__
    self.db=pg.connect(dbname='postgres',user='a_super_user',passwd='a_password',host='localhost',port=5432)

InternalError: could not connect to server: Permission denied
 Is the server running on host "localhost" and accepting
 TCP/IP connections on port 5432?



MODULE CACHE DETAILS

Accessed:       Mon Feb 18 12:04:11 2008
Generation:     0

_mp_85c706a52797631fd526e880ea631520 {
  FileName:     '/var/www/html/csp2/cart.py'
  Instance:     1 [IMPORT]
  Generation:   0 [ERROR]
  Modified:     Sat Aug  4 18:34:30 2007
  Children:     '/var/www/html/csp2/rsw.py',
                '/var/www/html/csp2/web_templates.py'
}

_mp_040d2e7b309cbc54463a95573b512c94 {
  FileName:     '/var/www/html/csp2/rsw.py'
  Instance:     1 [IMPORT]
  Generation:   2
  Modified:     Thu Feb 14 15:32:52 2008
  Imported:     Mon Feb 18 12:04:11 2008
}

_mp_7893a0b888652c1d2565a1ac1016c7e4 {
  FileName:     '/var/www/html/csp2/web_templates.py'
  Instance:     1 [IMPORT]
  Generation:   1
  Modified:     Sat Aug  4 21:15:48 2007
  Imported:     Mon Feb 18 12:04:11 2008

   
   

       
---------------------------------
Looking for last minute shopping deals?  Find them fast with Yahoo! Search.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20080218/5b402a2f/attachment.html


More information about the Mod_python mailing list