django - 使用 django-allauth 找不到页面(404)

标签 django django-allauth

我正在尝试将 django-allauth 合并到我的项目中。到目前为止,安装一切顺利,但是当我尝试访问“帐户”页面时,出现“找不到页面 404”错误。

这是输出:

Using the URLconf defined in Mysite.urls, Django tried these URL patterns, in this order:
    ^$ [name='home']
    ^contact$ [name='contact']
    ^about [name='about']
    ^login/$ [name='login']
    ^logout$ [name='logout']
    ^admin/
    ^accounts/
The current URL, accounts, didn't match any of these.

这是 Mysite.urls 文件:

"""
Definition of urls for Mysite.
"""

from datetime import datetime
from django.conf.urls import patterns, url
from app.forms import BootstrapAuthenticationForm

# Uncomment the next lines to enable the admin:
from django.conf.urls import include
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Examples:
    url(r'^$', 'app.views.home', name='home'),
    url(r'^contact$', 'app.views.contact', name='contact'),

    # SNIP #

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),

    # Allauth
    url(r'^accounts/', include('allauth.urls'))
)

我所做的所有事情都是在 this installation documentation 之后完成的。我基本上已将所有内容复制粘贴到 settings.py 中。

这可能是什么原因?运行 manage.pysyncdb 或启动服务器时,我没有收到任何错误。

最佳答案

allauth 没有“索引”页面 (/accounts/)。相反,您可以访问如下页面:

/accounts/signup/
/accounts/login/

如果您在settings.py中设置DEBUG = True,您将能够看到/accounts/下的所有可用页面,例如:

enter image description here

关于django - 使用 django-allauth 找不到页面(404),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29017251/

相关文章:

django - 如何在链查询中使用自定义管理器?

python - 使用 django-allauth

python - Django Rest auth user_logged_in 信号

python - 具有 postgres 引用约束的 Django Arrayfield

Django 休息注册

python - django-allauth:检查用户是否使用社交帐户注册

python - 我无法循环遍历 Django 模板中的字典

java - Heroku:如何指定JVM buildpack非java项目的路径?

sql - 拒绝两个字段中的空值