如何与allauth一起使用夹层?

时间:2017-10-31 19:13:10

标签: django mezzanine allauth

我在settings.INSTALLED_APPS中评论了夹层mezzanine.accounts,并将allauth用作AUTHENTICATION_BACKEND

settings.py
AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend"
)
urls.py:
urlpatterns += [
    url(r"^$", include("movies.urls")),
    url("^blog2", blog_post_list, name="home"),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^movies/", include("movies.urls", namespace="movies")),
    url(r"^faq/", include("fack.urls")),
    url(r"^accounts/", include("allauth.urls")),
    url(r'^captcha/', include('captcha.urls')),
    url(r'^jsi18n/$', JavaScriptCatalog.as_view(), name='javascript-catalog'),
    url(r'^tz_detect/', include('tz_detect.urls')),
    url(r"^h/", include("home2.urls", namespace="home2")),
    url(r"^profile/", include("profile.urls", namespace="profile")),
    url("^", include("mezzanine.urls")),
]

问题在于,当我转到https://localhost/blog2时,我看到了allauth.accounts的base.html。

也许mezzanine会将allauth accounts / base.html与自己的帐户/ base.html混淆?或者也许我错过了其他的东西。

1 个答案:

答案 0 :(得分:0)

url("^blog2", blog_post_list, name="home"),使用blog / blog_post_list.html作为扩展base.html的模板,但由于博客/应用程序中没有base.html,因此使用了第一个它可以找到的allauth,因此混淆

即。在<project_path>/templates/base.html中创建base.html,例如使用mezzanine/core/templates/base.html作为模板,解决了它