Ich stelle meine Django-Site auf einem Ubuntu 8.10-Server bereit, den ich von Grund auf neu eingerichtet habe. Ich bin völlig neu in diesem Bereich, so dass es viele Sachen geben kann, die ich vermisst habe, aber ich habe mich glücklicherweise bis zur Bereitstellung einer Website durchgesetzt.Django/mod_wsgi/postgresql_psycopg2: kann keine Verbindung herstellen Authentifizierung schlägt fehl (aber Einstellungen funktionieren gut unter django runserver oder dbshell)
Meine letzte Hürde:
Ich erhalte einen Authentifizierungsfehler mit postgresql
[Sun Apr 19 18:44:05 2009] [error] [client 124.254.102.127]
mod_wsgi (pid=30304): Exception occurred processing WSGI script '/home/acacian/webapps/acacian/deploy/acacian.wsgi'.
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/core/handlers/base.py", line 73, in get_response
response = middleware_method(request)
File "/home/acacian/webapps/pinax-env/src/django-openid/django_openid/consumer.py", line 383, in process_request
if self.session_key in request.session:
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/sessions/backends/base.py", line 43, in __contains__
return key in self._session
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/sessions/backends/base.py", line 172, in _get_session
self._session_cache = self.load()
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/sessions/backends/db.py", line 16, in load
expire_date__gt=datetime.datetime.now()
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/manager.py", line 120, in get
return self.get_query_set().get(*args, **kwargs)
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 269, in get
num = len(clone)
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 68, in __len__
self._result_cache = list(self.iterator())
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/query.py", line 207, in iterator
for row in self.query.results_iter():
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 262, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/models/sql/query.py", line 2288, in execute_sql
cursor = self.connection.cursor()
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/backends/__init__.py", line 81, in cursor
cursor = self._cursor()
File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/db/backends/postgresql_psycopg2/base.py", line 98, in _cursor
self.connection = Database.connect(**conn_params)
OperationalError: FATAL: Ident authentication failed for user "acacian"
Hinweis:
- die gleichen Einstellungen funktionieren unter runserver und dbshell
- mod_wsgi hat habe mit sqlite3 gearbeitet (ich bin an der Stelle der Umschaltung)
acacian.wsgi (ein wenig chaotisch)
# basic_project.wsgi is configured to live in projects/basic_project/deploy.
import os
import sys
import site
sys.stdout = sys.stderr
from os.path import abspath, dirname, join
from site import addsitedir
# the project path & pinax src paths
sys.path.insert(0, abspath(join(dirname(__file__), "../../")))
sys.path.insert(0, abspath(join(dirname(__file__), "../../pinax-env/src/pinax")))
sys.path.insert(0, abspath(join(dirname(__file__), "../../pinax-env/src")))
sys.path = ['/home/acacian/webapps/acacian/apps', '/home/acacian/webapps/pinax-env/src/pinax/pinax/apps', '/home/acacian/webapps/acacian', '/home/acacian/webapps/pinax-env/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg', '/home/acacian/webapps/pinax-env/lib/python2.5/site-packages/pip-0.3.1-py2.5.egg', '/home/acacian/webapps/pinax-env/src/pinax', '/home/acacian/webapps/pinax-env/src/django-openid', '/home/acacian/webapps/pinax-env/src/atom-format', '/home/acacian/webapps/pinax-env/src/django-app-plugins', '/home/acacian/webapps/pinax-env/src/diff-match-patch', '/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg', '/usr/lib/python2.5/site-packages/pip-0.3.1-py2.5.egg', '/home/acacian/webapps/pinax-env/lib/python2.5', '/home/acacian/webapps/pinax-env/lib/python2.5/plat-linux2', '/home/acacian/webapps/pinax-env/lib/python2.5/lib-tk', '/home/acacian/webapps/pinax-env/lib/python2.5/lib-dynload', '/usr/lib/python2.5', '/usr/lib/python2.5/plat-linux2', '/usr/lib/python2.5/lib-tk', '/home/acacian/webapps/pinax-env/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages', '/usr/lib/python2.5/site-packages/PIL', '/var/lib/python-support/python2.5'] + sys.path
# A version of activate_this from the mod_wsgi documentation site.
ALLDIRS = ['/home/acacian/webapps/acacian/pinax-env/lib/python2.5/site-packages']
# Remember original sys.path.
prev_sys_path = list(sys.path)
# Add each new site-packages directory.
for directory in ALLDIRS:
site.addsitedir(directory)
# Reorder sys.path so new directories at the front.
new_sys_path = []
for item in list(sys.path):
if item not in prev_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path
#print sys.path
from django.conf import settings
os.environ["DJANGO_SETTINGS_MODULE"] = "acacian.settings"
sys.path.insert(0, join(settings.PINAX_ROOT, "apps"))
sys.path.insert(0, join(settings.PROJECT_ROOT, "apps"))
from django.core.handlers.wsgi import WSGIHandler
application = WSGIHandler()
Thank you!