django allauth基本设置

django allauth基本设置,django,django-allauth,Django,Django Allauth,我试着跟踪最新消息 url.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', 'djan

我试着跟踪最新消息

url.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
,但当我访问我的localhost:8000/accounts/login/时,它给了我一个未找到的页面(404)。我还仔细检查了我在:上的教程中所做的操作,但我不确定还要做什么才能显示基本的登录屏幕。有什么建议吗

编辑

除了找不到页面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/
Django使用asa.URL中定义的URLconf,按以下顺序尝试了这些URL模式:
^管理员/
^账户/^^注册/$[name='account\u signup']
^账户/^^登录/$[name='account\u login']
^账户/^^注销/$[name='account\u注销']
^帐户/^^密码/change/$[name='account\u change\u password']
^帐户/^^密码/set/$[name='account\u set\u password']
^帐户/^^非活动/$[name='account\u inactive']
^账户/^^电子邮件/$[name='account\u email']
^帐户/^^确认电子邮件/$[name='account\u email\u verification\u sent']
^帐户/^^^确认电子邮件/(?P\w+)/$[name='account\u confirm\u email']
^帐户/^^确认电子邮件/(?P\w+)/$
^帐户/^^密码/reset/$[name='account\u reset\u password']
^帐户/^^^密码/reset/done/$[name='account\u reset\u password\u done']
^账户/^^^密码/reset/key/(?P[0-9A-Za-z]+)-(?P.+)/$[name='account\u reset\u password\u from\u key']
^帐户/^^^密码/reset/key/done/$[name='account\u reset\u password\u from\u key\u done']
^帐户/^social/

当前URL accounts/profile/与其中任何一个都不匹配。

只需检查:您启动服务器了吗

python manage.py runserver
编辑:

看起来您正在尝试
accounts/profile/
,它不是注册的URL。如果您转到
localhost:8000/accounts/register
,是否仍会出现错误

此外,从:

当我尝试登录时,在/accounts/profile/

当您到达这里时,您已成功登录。但是,您需要自己实现该URL的视图,因为此处显示的内容都是特定于项目的。您还可以决定重定向到其他位置

看起来您需要为帐户/配置文件编写自己的视图/

如果需要,可以在
settings.py
中将登录重定向设置为其他页面。即:

LOGIN_REDIRECT_URL = "/"

这会把你送回你的主页。

哈哈,是的,我已经开始了。我可以在/admin部分看到,为站点和社交帐户创建了表。您可以发布关于您收到的错误的更多详细信息吗?我刚刚用错误更新了帖子,似乎说它包含来自allauth.urlsOk的URL,请参阅我的新编辑。我猜你已经登录了,所以它会将你重定向到你的登录地址(django中的默认值是accounts/profile。你需要(1)在设置中更改它,或者(2)为accounts/profile/添加一个url和视图。让我知道这是否有意义。我真的很高兴看到了这一点。我刚开始使用AllAuth。为此,我必须登录到admin并设置一个应用程序配置文件。然后我做的第一件事是尝试使用accounts/login对其进行测试,并将其重定向到profile,而该配置文件并不存在。它让人迷失方向g被定向到一个我没有指定的不存在的页面,很难说这是因为AllAuth看到我已经登录了。看到这条评论后,我就去了管理员那里,然后注销,砰的一声!一切都正常了。非常整洁。