我正在尝试使用 django 1.6 的 django-browserid==0.9,在按照 0.9 的文档配置应用程序并登录用户后,我得到:
ImproperlyConfigured at /browserid/login/
request `http://127.0.0.1:8000`, was not found in SITE_URL `['http://localhost:8000']`
堆栈跟踪似乎导致:
/local/lib/python2.7/site-packages/django_browserid/views.py in dispatch
def dispatch(self, request, *args, **kwargs):
"""Run some sanity checks on the request prior to dispatching it."""
sanity_checks(request)
return super(Verify, self).dispatch(request, *args, **kwargs)
我有以下设置(与浏览器 ID 相关):
#settings.py
LOGIN_REDIRECT_URL = '/thanks'
LOGIN_REDIRECT_URL_FAILURE = '/'
LOGOUT_REDIRECT_URL = '/'
SITE_URL = 'http://localhost:8000'
BROWSERID_CREATE_USER = True
def username(email):
return email.rsplit('@', 1)[0]
BROWSERID_USERNAME_ALGO = username
#views.py
class HomeTemplateView(TemplateView):
template_name = "base.html"
class ThanksTemplateView(TemplateView):
template_name = "thanks.html"
#urls.py
urlpatterns = patterns('',
url(r'^$', HomeTemplateView.as_view(), name='home'),
url(r'^thanks/$', ThanksTemplateView.as_view(), name='thanks'),
url(r'^browserid/', include('django_browserid.urls')),
url(r'^admin/', include(admin.site.urls)),
)
如果有人能指出我解决这个问题的正确方向(或者我在这里做一些愚蠢的事情!),我将不胜感激。
非常感谢。