有关自定义Django身份验证模板的问题

时间:2020-01-14 03:14:23

标签: python django python-3.x django-3.0

我正在使用Django 3和Python 3.7。

我一直在摸索一些模板,但似乎找不到“成功”模板,例如“ password_change_done”和“ password_reset_done”。两者都给出类似的错误消息。

在/ users / password_change /

处的NoReverseMatch

未找到“ password_change_done”的反面。 'password_change_done'不是 有效的视图函数或模式名称。

我的项目urls.py中有这个

    urlpatterns = [
      path( "users/", include( "users.urls" ) )
    , path( "admin/", admin.site.urls )
    , path( "", include( "main.urls" ) )  #  Played with this up top, and here on the bottom.
]

在users \ urls.py中:

urlpatterns = [
      #  Include default auth urls.
      path( "", include( "django.contrib.auth.urls" ) )
      ...
]

我什至尝试添加TEMPLATES.DIRS值来指向用户/模板。

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [ os.path.join( BASE_DIR, "users/templates" ) ],  #  With and Without this.
        "APP_DIRS": True,
        ...
        },
    },
]

我觉得path( "", include( "django.contrib.auth.urls" ) )应该包含正确的参考,但是我需要单独列出每个参考吗?我该怎么办?

1 个答案:

答案 0 :(得分:0)

参照以下自定义网址的特定视图。

char buffer[8096]; // larger = faster (within limits)
std::ofstream file;
file.rdbuf()->pubsetbuf(buffer, sizeof(buffer));

file.open("vectors.csv");
for (std::size_t i = 0 ; i < N ; i++) {
    // use single chars '\n'
    // use single chars ','
    file << array[3*i] << ',' << array[3*i+1] << ',' << array[3*i+2] << '\n';
}

docs中查看详细信息。

相关问题