我使用django-registraion进行用户身份验证。我通过pip安装了django-registration并添加到settings.py文件中。然而它仍然给我Templtate不存在的错误。这是错误:
TemplateDoesNotExist at /accounts/login/
registration/login.html
Request Method: GET
Request URL: http://127.0.0.1:8000/accounts/login/?next=/
Django Version: 1.11.3
Exception Type: TemplateDoesNotExist
Exception Value: registration/login.html
Exception Location: C:\Python34\lib\site- packages\django\template\loader.py in select_template, line 53
以下是代码:
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth.views import login, logout
from chat.views import index
from django.conf.urls import include
urlpatterns = [
url('^', include('django.contrib.auth.urls')),
url(r'^admin/', admin.site.urls),
url(r'^$',index, name='homepage'), # The start point for index view
url(r'^accounts/login/$', login, name='login'), # The base django login view
url(r'^accounts/logout/$', logout, name='logout'), # The base django logout view
settings.py文件中的:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'chat',
'registration',
]
答案 0 :(得分:2)
模板文件夹似乎位于根目录,因此您需要将设置更改为此
Task<object>