new*_*mer 15 django django-allauth
我试着关注最新的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')),
)
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
我跑了python manage.py syncdb
但是当我访问我的localhost时:8000/accounts/login /,它给了我找不到页面(404).我还仔细检查了我在教程中做了什么:http://www.sarahhagstrom.com/2013/09/the-missing-django-allauth-tutorial/但我不知道还有什么可以做一个基本的登录界面显示.有什么指针吗?
编辑
除了Page Not Found 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/
Run Code Online (Sandbox Code Playgroud)
当前网址(accounts/profile /)与其中任何一个都不匹配.
Ale*_*lex 21
只是为了检查一下:你启动了服务器吗?
python manage.py runserver
Run Code Online (Sandbox Code Playgroud)
编辑:
看起来你正在尝试accounts/profile/
,这不是一个注册的URL.如果你去,它仍然会出错localhost:8000/accounts/register
吗?
另外,来自文档:
当我尝试登录时,我在/ accounts/profile /上遇到了404
当你在这里结束时,你已经成功登录.但是,你需要自己实现这个URL的视图,因为这里显示的是项目特定的.您也可以决定在其他地方重定向.
看起来您需要为帐户/个人资料/编写自己的视图
如果需要,您可以将登录重定向设置为其他页面settings.py
.即:
LOGIN_REDIRECT_URL = "/"
Run Code Online (Sandbox Code Playgroud)
这会将您发送回您的主页.
归档时间: |
|
查看次数: |
6570 次 |
最近记录: |