Chas. Munat
Seattle
(Not knowing yet what is important, I included everything here. If there
are parts of the error message I can leave out, then please let me know.
Thanks.)
DoesNotExist at /accounts/login/
Site matching query does not exist.
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/
Exception Type: DoesNotExist
Exception Value: Site matching query does not exist.
Exception Location:
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py
in get, line 204
Traceback (innermost last)
Switch to copy-and-paste view
*
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py
in get_response
67. # Apply view middleware
68. for middleware_method in self._view_middleware:
69. response = middleware_method(request, callback,
callback_args, callback_kwargs)
70. if response:
71. return response
72.
73. try:
74. response = callback(request, *callback_args,
**callback_kwargs) ...
75. except Exception, e:
76. # If the view raised an exception, run it through exception
77. # middleware, and if the exception middleware returns a
78. # response, use that. Otherwise, reraise the exception.
79. for middleware_method in self._exception_middleware:
80. response = middleware_method(request, e)
▼ Local vars
Variable Value
callback
<function login at 0x14330b0>
callback_args
()
callback_kwargs
{}
e
<django.db.models.base.DoesNotExist instance at 0x14406e8>
exceptions
<module 'django.core.exceptions' from
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/exceptions.pyc'>
mail_admins
<function mail_admins at 0x13f9a30>
middleware_method
<bound method XViewMiddleware.process_view of
<django.middleware.doc.XViewMiddleware instance at 0x1406490>>
path
'/accounts/login/'
request
<DjangoRequest GET:<MultiValueDict: {'next': ['/']}>,
POST:<MultiValueDict: {}>, COOKIES:{'sessionid':
'e567534679a1e0c44432fcf3f28d9160'}, META:{'ANT_HOME':
'/usr/local/apache-ant', 'CATALINA_BASE': '/usr/local/tomcat',
'CATALINA_HOME': '/usr/local/tomcat', 'CATALINA_TMPDIR':
'/usr/local/tomcat/temp', 'CONTENT_LENGTH': '', 'CONTENT_TYPE':
'text/plain', 'DJANGO_SETTINGS_MODULE': 'xxx.settings',
'GATEWAY_INTERFACE': 'CGI/1.1', 'HOME': '/Users/administrator',
'HTTP_ACCEPT':
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION':
'keep-alive', 'HTTP_COOKIE':
'sessionid=e567534679a1e0c44432fcf3f28d9160', 'HTTP_HOST':
'127.0.0.1:8000', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT':
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.4)
Gecko/20060508 Firefox/1.5.0.4', 'JAVA_HOME': '/usr', 'JRE_HOME':
'/usr', 'LOGNAME': 'administrator', 'OLDPWD': '/Users/administrator',
'PATH':
'/opt/local/bin:/usr/bin:/usr/local/bin:/bin:/opt/local/lib/mysql5/bin:/opt/local/lib/pgsql8/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.4/bin/',
'PATH_INFO': '/accounts/login/', 'PWD': '/Users/administrator/xxx',
'QUERY_STRING': 'next=/', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST':
'poker.localhost', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SECURITYSESSIONID': '59b690', 'SERVER_NAME':
'poker.localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.4.2', 'SHELL': '/bin/bash',
'SHLVL': '1', 'TERM': 'xterm-color', 'TERM_PROGRAM': 'Apple_Terminal',
'TERM_PROGRAM_VERSION': '133', 'TZ': 'America/Chicago', 'USER':
'administrator', '_': '/opt/local/bin/python',
'__CF_USER_TEXT_ENCODING': '0x1F9:0:0', 'wsgi.errors': <open file
'<stderr>', mode 'w' at 0x140b0>, 'wsgi.file_wrapper': <class
django.core.servers.basehttp.FileWrapper at 0x77f540>, 'wsgi.input':
<socket._fileobject object at 0x1380f48>, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
resolver
<django.core.urlresolvers.RegexURLResolver object at 0x1430550>
response
None
self
<django.core.handlers.wsgi.WSGIHandler instance at 0x7aad50>
settings
<django.conf.LazySettings instance at 0x592c10>
urlresolvers
<module 'django.core.urlresolvers' from
'/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/urlresolvers.pyc'>
*
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/auth/views.py
in login
21. redirect_to = '/accounts/profile/'
22. request.session[SESSION_KEY] = manipulator.get_user_id()
23. request.session.delete_test_cookie()
24. return HttpResponseRedirect(redirect_to)
25. else:
26. errors = {}
27. request.session.set_test_cookie()
28. return render_to_response('registration/login.html', { ...
29. 'form': forms.FormWrapper(manipulator, request.POST, errors),
30. REDIRECT_FIELD_NAME: redirect_to,
31. 'site_name': Site.objects.get_current().name,
32. }, context_instance=RequestContext(request))
33.
34. def logout(request, next_page=None):
▼ Local vars
Variable Value
errors
{}
manipulator
<django.contrib.auth.forms.AuthenticationForm object at 0x1435e10>
redirect_to
'/'
request
<DjangoRequest GET:<MultiValueDict: {'next': ['/']}>,
POST:<MultiValueDict: {}>, COOKIES:{'sessionid':
'e567534679a1e0c44432fcf3f28d9160'}, META:{'ANT_HOME':
'/usr/local/apache-ant', 'CATALINA_BASE': '/usr/local/tomcat',
'CATALINA_HOME': '/usr/local/tomcat', 'CATALINA_TMPDIR':
'/usr/local/tomcat/temp', 'CONTENT_LENGTH': '', 'CONTENT_TYPE':
'text/plain', 'DJANGO_SETTINGS_MODULE': 'xxx.settings',
'GATEWAY_INTERFACE': 'CGI/1.1', 'HOME': '/Users/administrator',
'HTTP_ACCEPT':
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5',
'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.5', 'HTTP_CACHE_CONTROL': 'max-age=0', 'HTTP_CONNECTION':
'keep-alive', 'HTTP_COOKIE':
'sessionid=e567534679a1e0c44432fcf3f28d9160', 'HTTP_HOST':
'127.0.0.1:8000', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT':
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.4)
Gecko/20060508 Firefox/1.5.0.4', 'JAVA_HOME': '/usr', 'JRE_HOME':
'/usr', 'LOGNAME': 'administrator', 'OLDPWD': '/Users/administrator',
'PATH':
'/opt/local/bin:/usr/bin:/usr/local/bin:/bin:/opt/local/lib/mysql5/bin:/opt/local/lib/pgsql8/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.4/bin/',
'PATH_INFO': '/accounts/login/', 'PWD': '/Users/administrator/xxx',
'QUERY_STRING': 'next=/', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST':
'poker.localhost', 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true',
'SCRIPT_NAME': '', 'SECURITYSESSIONID': '59b690', 'SERVER_NAME':
'poker.localhost', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1',
'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.4.2', 'SHELL': '/bin/bash',
'SHLVL': '1', 'TERM': 'xterm-color', 'TERM_PROGRAM': 'Apple_Terminal',
'TERM_PROGRAM_VERSION': '133', 'TZ': 'America/Chicago', 'USER':
'administrator', '_': '/opt/local/bin/python',
'__CF_USER_TEXT_ENCODING': '0x1F9:0:0', 'wsgi.errors': <open file
'<stderr>', mode 'w' at 0x140b0>, 'wsgi.file_wrapper': <class
django.core.servers.basehttp.FileWrapper at 0x77f540>, 'wsgi.input':
<socket._fileobject object at 0x1380f48>, 'wsgi.multiprocess': False,
'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme':
'http', 'wsgi.version': (1, 0)}>
*
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/manager.py
in get
59. def distinct(self, *args, **kwargs):
60. return self.get_query_set().distinct(*args, **kwargs)
61.
62. def extra(self, *args, **kwargs):
63. return self.get_query_set().extra(*args, **kwargs)
64.
65. def get(self, *args, **kwargs):
66. return self.get_query_set().get(*args, **kwargs) ...
67.
68. def filter(self, *args, **kwargs):
69. return self.get_query_set().filter(*args, **kwargs)
70.
71. def complex_filter(self, *args, **kwargs):
72. return self.get_query_set().complex_filter(*args, **kwargs)
▼ Local vars
Variable Value
args
()
kwargs
{'pk': 1}
self
<django.contrib.sites.models.SiteManager object at 0x1399af0>
*
/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py
in get
197. "Performs the SELECT and returns a single object matching
the given keyword arguments."
198. clone = self.filter(*args, **kwargs)
199. # clean up SQL by removing unneeded ORDER BY
200. if not clone._order_by:
201. clone._order_by = ()
202. obj_list = list(clone)
203. if len(obj_list) < 1:
204. raise self.model.DoesNotExist, "%s matching query does not
exist." % self.model._meta.object_name ...
205. assert len(obj_list) == 1, "get() returned more than one %s
-- it returned %s! Lookup parameters were %s" %
(self.model._meta.object_name, len(obj_list), kwargs)
206. return obj_list[0]
207.
208. def latest(self, field_name=None):
209. """
210. Returns the latest object, according to the model's
'get_latest_by'
▼ Local vars
Variable Value
args
()
clone
[]
kwargs
{'pk': 1}
obj_list
[]
self
[<Site: xx.xxx.org>]
Traceback (most recent call last):
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/handlers/base.py"
in get_response
74. response = callback(request, *callback_args, **callback_kwargs)
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/contrib/auth/views.py"
in login
28. return render_to_response('registration/login.html', {
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/manager.py"
in get
66. return self.get_query_set().get(*args, **kwargs)
File
"/opt/local/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/query.py"
in get
204. raise self.model.DoesNotExist, "%s matching query does not
exist." % self.model._meta.object_name
DoesNotExist at /accounts/login/
Site matching query does not exist.
Request information
GET
Variable Value
next
'/'
POST
No POST data
COOKIES
Variable Value
sessionid
'e567534679a1e0c44432fcf3f28d9160'
META
Variable Value
ANT_HOME
'/usr/local/apache-ant'
CATALINA_BASE
'/usr/local/tomcat'
CATALINA_HOME
'/usr/local/tomcat'
CATALINA_TMPDIR
'/usr/local/tomcat/temp'
CONTENT_LENGTH
''
CONTENT_TYPE
'text/plain'
DJANGO_SETTINGS_MODULE
'xxx.settings'
GATEWAY_INTERFACE
'CGI/1.1'
HOME
'/Users/administrator'
HTTP_ACCEPT
'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5'
HTTP_ACCEPT_CHARSET
'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_ACCEPT_ENCODING
'gzip,deflate'
HTTP_ACCEPT_LANGUAGE
'en-us,en;q=0.5'
HTTP_CACHE_CONTROL
'max-age=0'
HTTP_CONNECTION
'keep-alive'
HTTP_COOKIE
'sessionid=e567534679a1e0c44432fcf3f28d9160'
HTTP_HOST
'127.0.0.1:8000'
HTTP_KEEP_ALIVE
'300'
HTTP_USER_AGENT
'Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.4)
Gecko/20060508 Firefox/1.5.0.4'
JAVA_HOME
'/usr'
JRE_HOME
'/usr'
LOGNAME
'administrator'
OLDPWD
'/Users/administrator'
PATH
'/opt/local/bin:/usr/bin:/usr/local/bin:/bin:/opt/local/lib/mysql5/bin:/opt/local/lib/pgsql8/bin:/opt/local/Library/Frameworks/Python.framework/Versions/2.4/bin/'
PATH_INFO
'/accounts/login/'
PWD
'/Users/administrator/xxx'
QUERY_STRING
'next=/'
REMOTE_ADDR
'127.0.0.1'
REMOTE_HOST
'poker.localhost'
REQUEST_METHOD
'GET'
RUN_MAIN
'true'
SCRIPT_NAME
''
SECURITYSESSIONID
'59b690'
SERVER_NAME
'poker.localhost'
SERVER_PORT
'8000'
SERVER_PROTOCOL
'HTTP/1.1'
SERVER_SOFTWARE
'WSGIServer/0.1 Python/2.4.2'
SHELL
'/bin/bash'
SHLVL
'1'
TERM
'xterm-color'
TERM_PROGRAM
'Apple_Terminal'
TERM_PROGRAM_VERSION
'133'
TZ
'America/Chicago'
USER
'administrator'
_
'/opt/local/bin/python'
__CF_USER_TEXT_ENCODING
'0x1F9:0:0'
wsgi.errors
<open file '<stderr>', mode 'w' at 0x140b0>
wsgi.file_wrapper
<class django.core.servers.basehttp.FileWrapper at 0x77f540>
wsgi.input
<socket._fileobject object at 0x1380f48>
wsgi.multiprocess
False
wsgi.multithread
True
wsgi.run_once
False
wsgi.url_scheme
'http'
wsgi.version
(1, 0)
Settings
Using settings module xxx.settings
Setting Value
ABSOLUTE_URL_OVERRIDES
{}
ADMINS
()
ADMIN_FOR
()
ADMIN_MEDIA_PREFIX
'/media/'
ALLOWED_INCLUDE_ROOTS
()
APPEND_SLASH
True
BANNED_IPS
()
CACHE_BACKEND
'simple://'
CACHE_MIDDLEWARE_KEY_PREFIX
''
COMMENTS_ALLOW_PROFANITIES
False
COMMENTS_BANNED_USERS_GROUP
None
COMMENTS_FIRST_FEW
0
COMMENTS_MODERATORS_GROUP
None
COMMENTS_SKETCHY_USERS_GROUP
None
DATABASE_ENGINE
'postgresql'
DATABASE_HOST
''
DATABASE_NAME
'xxx_development'
DATABASE_PASSWORD
'********************'
DATABASE_PORT
''
DATABASE_USER
'django'
DATETIME_FORMAT
'N j, Y, P'
DATE_FORMAT
'N j, Y'
DEBUG
True
DEFAULT_CHARSET
'utf-8'
DEFAULT_CONTENT_TYPE
'text/html'
DEFAULT_FROM_EMAIL
'webmaster@localhost'
DISALLOWED_USER_AGENTS
()
EMAIL_HOST
'localhost'
EMAIL_HOST_PASSWORD
'********************'
EMAIL_HOST_USER
''
EMAIL_PORT
25
EMAIL_SUBJECT_PREFIX
'[Django] '
ENABLE_PSYCO
False
IGNORABLE_404_ENDS
('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
'.php')
IGNORABLE_404_STARTS
('/cgi-bin/', '/_vti_bin', '/_vti_inf')
INSTALLED_APPS
['django.contrib.auth', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sites',
'django.contrib.admin', 'xxx.xx']
INTERNAL_IPS
()
JING_PATH
'/usr/bin/jing'
LANGUAGES
(('bn', 'Bengali'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'),
('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('es', 'Spanish'),
('es_AR', 'Argentinean Spanish'), ('fr', 'French'), ('gl', 'Galician'),
('hu', 'Hungarian'), ('he', 'Hebrew'), ('is', 'Icelandic'), ('it',
'Italian'), ('ja', 'Japanese'), ('nl', 'Dutch'), ('no', 'Norwegian'),
('pt-br', 'Brazilian'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk',
'Slovak'), ('sl', 'Slovenian'), ('sr', 'Serbian'), ('sv', 'Swedish'),
('uk', 'Ukrainian'), ('zh-cn', 'Simplified Chinese'), ('zh-tw',
'Traditional Chinese'))
LANGUAGES_BIDI
('he',)
LANGUAGE_CODE
'en-us'
MANAGERS
()
MEDIA_ROOT
''
MEDIA_URL
''
MIDDLEWARE_CLASSES
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware')
MONTH_DAY_FORMAT
'F j'
PREPEND_WWW
False
ROOT_URLCONF
'xxx.urls'
SECRET_KEY
'********************'
SEND_BROKEN_LINK_EMAILS
False
SERVER_EMAIL
'root@localhost'
SESSION_COOKIE_AGE
1209600
SESSION_COOKIE_DOMAIN
None
SESSION_COOKIE_NAME
'sessionid'
SESSION_EXPIRE_AT_BROWSER_CLOSE
False
SESSION_SAVE_EVERY_REQUEST
False
SETTINGS_MODULE
'xxx.settings'
SITE_ID
1
TEMPLATE_CONTEXT_PROCESSORS
('django.core.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n')
TEMPLATE_DEBUG
True
TEMPLATE_DIRS
('/Users/administrator/xxx/templates/',)
TEMPLATE_LOADERS
('django.template.loaders.filesystem.load_template_source',
'django.template.loaders.app_directories.load_template_source')
TEMPLATE_STRING_IF_INVALID
''
TIME_FORMAT
'P'
TIME_ZONE
'America/Chicago'
TRANSACTIONS_MANAGED
False
USE_ETAGS
False
YEAR_MONTH_FORMAT
'F Y'
All the best,
Rob
You may want these in your project's url.py file too....
(r'^logout/', 'django.views.auth.login.logout'),
(r'', 'django.views.auth.login.login'),
(r'^login/', 'django.views.auth.login.login'),
(r'^accounts/login', 'django.views.auth.login.login'),
Hope this helps
/Paul
My urls.py includes:
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
which I copied and pasted directly from
http://www.djangoproject.com/documentation/authentication/
> If this is the case, then
> http://www.djangoproject.com/documentation/tutorial3/ should hopefully
> cover what you'll need.
Nope. I read the tutorial from start to finish twice and managed to get
the Poll site working. My current site is only a rough outline so far,
but the Admin portion is working fine, so I know that the urls.py works.
I've also looked into the django-project files and the auth.views.login
method is there. I honestly don't know why I'm getting the error.
Thanks,
Chas. Munat
Seattle
Jason McBrayer uses the following regexs in his urls.py file:
(r'^accounts/login/', 'django.views.auth.login.login'),
(r'^accounts/logout/', 'django.views.auth.login.logout'),
I am using
(r'^accounts/login/$', 'django.contrib.auth.views.login'),
Note the $ symbol. I've tried it with and without the $. No difference.
Also note that he is using views.auth.login.login vs.
contrib.auth.views.login, which is what the Authentication documents --
http://www.djangoproject.com/documentation/authentication/
use. I copied and pasted from them, in fact. When I use his regexs
instead, I get the following error:
ViewDoesNotExist at /accounts/login/
Could not import django.views.auth.login. Error was: No module named
auth.login
So I don't think his are correct for the current version I'm using. (I
pulled it from SVN some two days ago.) And when I follow the path
contrib/auth/, I do find a views.py file with a method called login, so
I think that contrib.auth.views.login is correct.
Chas. Munat
Seattle
The only other thing I can suggest is to chekc if you have your login
and logout templates in the right place and that the template locations
are in your settings.py file.
Sorry I couldn't help out. Good luck.
I think so. The other templates are working. But one thing: the Auth
docs say there should be a template at registration/login.html. So in my
templates directory (which I know is set properly) I created a
registration directory and added the template in it with filename
login.html. That is my interpretation of how that should work. I've
tried moving this file and directory around, but that doesn't seem to be it.
> Sorry I couldn't help out. Good luck.
No prob. All efforts greatly appreciated.
Chas. Munat
Seattle