I have just started to integrate django_digest into my app. As a start I have added the @httpdigest decorator to one of my views. If I try to connect to it I get a KeyError exception thrown in django_digest/backend/db.py . Depending on which db I configure I get a different KeyError in a different location. I am using Django 1.2.1, with MySql (also tested with sqlite). I am using the default values for all the settings options.
我可以看到,我遵守了所有指示,但每天都在为此而努力。 我使用的是集延戈-最穷困者和最穷困者。 任何指示都将受到高度赞赏。
below和 my泥的追踪:
注:
Traceback (most recent call last):
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 674, in __call__
return self.application(environ, start_response)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 248, in __call__
signals.request_finished.send(sender=self.__class__)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/dispatch/dispatcher.py", line 162, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/backend/db.py", line 16, in close_connection
_connection.close()
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 186, in close
if self.settings_dict[ NAME ] != ":memory:":
KeyError: NAME
注
Traceback (most recent call last):
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 674, in __call__
return self.application(environ, start_response)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
response = self.get_response(request)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 166, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/core/handlers/base.py", line 80, in get_response
response = middleware_method(request)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/middleware.py", line 13, in process_request
if (not self._authenticator.authenticate(request) and
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/__init__.py", line 86, in authenticate
partial_digest = self._account_storage.get_partial_digest(digest_response.username)
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django_digest-1.8-py2.5.egg/django_digest/backend/db.py", line 97, in get_partial_digest
cursor = get_connection().cursor()
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/__init__.py", line 75, in cursor
cursor = self._cursor()
File "/home/robm/projects/gcs/server/gcs2.5/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 281, in _cursor
if settings_dict[ USER ]:
KeyError: USER
<>Update-这似乎与Django 1.2和多数据库背对。 修改数据集,摘自:
_connection = backend.DatabaseWrapper({
DATABASE_HOST : settings.DATABASE_HOST,
DATABASE_NAME : settings.DATABASE_NAME,
DATABASE_OPTIONS : settings.DATABASE_OPTIONS,
DATABASE_PASSWORD : settings.DATABASE_PASSWORD,
DATABASE_PORT : settings.DATABASE_PORT,
DATABASE_USER : settings.DATABASE_USER,
TIME_ZONE : settings.TIME_ZONE,
})
内容提要
_connection = backend.DatabaseWrapper({
HOST : settings.DATABASE_HOST,
NAME : settings.DATABASE_NAME,
OPTIONS : settings.DATABASE_OPTIONS,
PASSWORD : settings.DATABASE_PASSWORD,
PORT : settings.DATABASE_PORT,
USER : settings.DATABASE_USER,
TIME_ZONE : settings.TIME_ZONE,
})
应加以确定。
现在,我转而使用《吉大港山区行动计划》的网页,但希望下周我有机会做一次小事。