我正在我从头开始设置的Ubuntu 8.10服务器上部署我的django站点.我对此完全陌生,所以可能有很多我错过的东西,但很高兴找到了我的方式来部署一个网站.
我的最后一个障碍:
我收到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"
注意:
相同的设置在runserver和dbshell下工作正常
mod_wsgi一直在使用sqlite3(我正在切换)
acacian.wsgi(有点乱)
# 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()
谢谢!
错误:
Ident authentication failed for user "acacian"
就是这个意思.
当您使用runserver或dbshell时,Django进程将以您的用户标识作为进程所有者运行.
当您在mod_wsgi下运行Django时,在守护进程模式下,它以WSGIDaemonProcess
指令中指定的用户身份运行.如果在嵌入式(非守护进程)模式下运行mod_wsgi,则userid将匹配Apache进程User
指令.
因此,您需要做的是将用户acacian
作为用户添加到postgresql createuser
,就像使用您自己的用户名一样.