【问题标题】:How to use mezzanine together with allauth?如何将夹层与 allauth 一起使用?
【发布时间】:2017-10-31 19:13:10
【问题描述】:

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

设置.py
AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend"
)
网址.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。

也许夹层将 allauth accounts/base.html 与它自己的 accounts/base.html 混淆了?或者我可能还缺少其他东西。

【问题讨论】:

    标签: django django-allauth mezzanine


    【解决方案1】:

    url("^blog2", blog_post_list, name="home"), 使用 blog/blog_post_list.html 作为扩展 base.html 的模板,但由于 blog/ 应用程序中没有 base.html,它使用了它可以找到的第一个,在这种情况下是 allauth,因此造成了混乱。

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

    【讨论】:

      猜你喜欢
      • 2017-12-23
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      • 1970-01-01
      • 2018-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多