我试着跟踪最新的http://django-allauth.readthedocs.org/en/latest/#installation
urls.py文件如下所示:
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^accounts/', include('allauth.urls')),
)settings.py文件有:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
)
TEMPLATE_CONTEXT_PROCESSORS = (
# Required by allauth template tags
"django.core.context_processors.request",
"django.contrib.auth.context_processors.auth",
# allauth specific context processors
"allauth.account.context_processors.account",
"allauth.socialaccount.context_processors.socialaccount",
)
AUTHENTICATION_BACKENDS = (
# Needed to login by username in Django admin, regardless of `allauth`
"django.contrib.auth.backends.ModelBackend",
# `allauth` specific authentication methods, such as login by e-mail
"allauth.account.auth_backends.AuthenticationBackend",
)
SITE_ID = 1我运行了python manage.py syncdb,但是当我访问本地主机:8000/accounts/login/时,它给了我Page (404)。我还检查了在:http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/上使用教程所做的工作,但我不确定还需要做什么才能显示基本的登录屏幕。有什么指示吗?
编辑
除了未找到的页面之外,还有页面上的错误404
Using the URLconf defined in asa.urls, Django tried these URL patterns, in this order:
^admin/
^accounts/ ^ ^signup/$ [name='account_signup']
^accounts/ ^ ^login/$ [name='account_login']
^accounts/ ^ ^logout/$ [name='account_logout']
^accounts/ ^ ^password/change/$ [name='account_change_password']
^accounts/ ^ ^password/set/$ [name='account_set_password']
^accounts/ ^ ^inactive/$ [name='account_inactive']
^accounts/ ^ ^email/$ [name='account_email']
^accounts/ ^ ^confirm-email/$ [name='account_email_verification_sent']
^accounts/ ^ ^confirm-email/(?P<key>\w+)/$ [name='account_confirm_email']
^accounts/ ^ ^confirm_email/(?P<key>\w+)/$
^accounts/ ^ ^password/reset/$ [name='account_reset_password']
^accounts/ ^ ^password/reset/done/$ [name='account_reset_password_done']
^accounts/ ^ ^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$ [name='account_reset_password_from_key']
^accounts/ ^ ^password/reset/key/done/$ [name='account_reset_password_from_key_done']
^accounts/ ^social/当前URL accounts/profile/与其中任何一个都不匹配。
发布于 2014-04-08 18:46:25
检查一下:您启动服务器了吗?
python manage.py runserver编辑:
看起来你在尝试accounts/profile/,它不是注册的URL。如果您转到localhost:8000/accounts/register,它还会产生错误吗?
同时,来自文档
当我尝试登录时,我在/accounts/profile/上遇到了一个404 当您在这里结束时,您已经成功地登录了。但是,您需要自己为这个URL实现一个视图,因为这里显示的任何内容都是特定于项目的。你也可以决定重新转向其他地方。
看起来您需要为accounts/profile/编写自己的视图
如果需要,可以将登录重定向到settings.py中的其他页面。即:
LOGIN_REDIRECT_URL = "/"这会把你送回你的主页。
https://stackoverflow.com/questions/22945578
复制相似问题