python3 Django TemplateDoesNotExist at /

来源:互联网 发布:如何编制软件 编辑:程序博客网 时间:2024/05/01 12:51

自己也是跟着别人的博客敲的出现的问题,这个是模板找不到路径。

在包含wsgi.py的同级目录中找到settings.py

然后在settings.py 找到这段代码:

TEMPLATES = [      {          'BACKEND': 'django.template.backends.django.DjangoTemplates',          'DIRS': [],          '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',              ],          },      },  ]  

出现上述问题主要是这里的DIRS:[] 中括号里面的内容为空,这里我们只需要填上os.path.join(BASE_DIR, 'templates')

os.path.join(BASE_DIR, 'templates')

阅读全文
0 0
原创粉丝点击