django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html 报错

django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html报错,
我在使用postman进行提交请求是能正常调用的,但是使用浏览器就会抛出这个错误
在这里插入图片描述
这是因为我们没在settings中的app中注册我们的rest_framework导致的。
只需在

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'app01.apps.App01Config',
    'rest_framework',
]

注册一下即可正常访问了。

posted @ 2019-05-14 15:41  a_py  阅读(1280)  评论(0编辑  收藏  举报