我已經安裝Django的allauth,隨後仔細的每一步:Django的allauth:不能反向匹配網址
Settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
'django.core.context_processors.request',
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
"allauth.account.auth_backends.AuthenticationBackend",
)
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
'allauth.account',
'allauth.socialaccount',
'allauth.socialaccount.providers.google',
...
)
ACCOUNT_AUTHENTICATION_METHOD="username_email"
url.py
(r'^accounts/', include('allauth.urls')),
但是,運行它時,我得到一個404在http://localhost:8000/accounts/
我試圖扭轉手動匹配它:
./manage.py shell
from allauth.socialaccount.providers.google.urls import *
工程確定。
./manage.py shell
from django.core.urlresolvers import reverse
reverse('/accounts/google/login/')
然而這一次失敗:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/kave/vc/cb-env/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 476, in reverse
return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/kave/vc/cb-env/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 396, in _reverse_with_prefix
"arguments '%s' not found." % (lookup_view_s, args, kwargs))
NoReverseMatch: Reverse for '/accounts/google/login/' with arguments '()' and keyword arguments '{}' not found.
我已經正確安裝了虛擬ENV中。出了什麼問題?或者是一個錯誤?
謝謝。你是對的。但是,我仍然在'http:// localhost:8000/accounts /'獲得404任何想法可能是錯誤的? – Houman 2013-02-12 23:42:17