image.png
TemplateDoesNotExist at /
base.html
Request Method: GET
Request URL: http://wanghongli.top:3000/
Django Version: 2.1.8
Exception Type: TemplateDoesNotExist
Exception Value:
base.html
Exception Location: /usr/local/lib/python3.7/site-packages/django/template/loader.py in get_template, line 19
Python Executable: /usr/bin/python
Python Version: 3.7.2
Python Path:
['/root/fileshare',
'/usr/local/lib/python37.zip',
'/usr/local/lib/python3.7',
'/usr/local/lib/python3.7/lib-dynload',
'/root/.local/lib/python3.7/site-packages',
'/usr/local/lib/python3.7/site-packages']
Server time: Thu, 7 May 2020 11:58:40 +0800
django.template.loaders.filesystem.Loader: /fileshare/templates/base.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.7/site-packages/django/contrib/admin/templates/base.html (Source does not exist)
django.template.loaders.app_directories.Loader: /usr/local/lib/python3.7/site-packages/django/contrib/auth/templates/base.html (Source does not exist)
setting.py修改:
...
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'fileshare/templates')], # 修改为这样
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
django Unicode error hint
文件里不要出现乱码就可以解决该错误了
网友评论