我在使用templateview时收到此错误

时间:2019-05-08 20:49:12

标签: python django django-rest-framework django-templates

TypeError位于/ 预期的str,字节或os.PathLike对象,而不是元组

我刚刚启动了templateview,CBV,并且即时通讯出现了这个问题

from django.shortcuts import render
from django.views.generic import View,TemplateView
from django.http import HttpResponse

class indexView(TemplateView):
    template_name = 'index.html'

错误:

TypeError at /
expected str, bytes or os.PathLike object, not tuple
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 2.2
Exception Type: TypeError
Exception Value:    
expected str, bytes or os.PathLike object, not tuple
Exception Location: /anaconda3/envs/mydjangoEnv/lib/python3.7/posixpath.py in join, line 80
Python Executable:  /anaconda3/envs/mydjangoEnv/bin/python
Python Version: 3.7.3
Python Path:    
['/Users/faiq/Desktop/exercise/CBV/advance',
 '/anaconda3/envs/mydjangoEnv/lib/python37.zip',
 '/anaconda3/envs/mydjangoEnv/lib/python3.7',
 '/anaconda3/envs/mydjangoEnv/lib/python3.7/lib-dynload',
 '/anaconda3/envs/mydjangoEnv/lib/python3.7/site-packages']
Server time:    Wed, 8 May 2019 21:01:19 +0000

0 个答案:

没有答案