以下是youtube教程:https://www.youtube.com/watch?v=psvU4zwO3Ao。它在Django服务器上构建了一个模板。我很有信心,我完全遵循了它,但是在基于app目录的views.py中收到了这个错误
应用程序目录中Views.py中的代码:
from django.shortcuts import render
def home(requests):
return render(requests, 'home/welcome.html')
正在放映
Traceback (most recent call last):
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "c:\Users\popec\PycharmProjects\djangoproject\mysite\home\views.py", line 5, in home
return render(requests, 'home/welcome.html')
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loader.py", line 61, in render_to_string
template = get_template(template_name, using=using)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loader.py", line 15, in get_template
return engine.get_template(template_name)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\backends\django.py", line 34, in get_template
return Template(self.engine.get_template(template_name), self)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\engine.py", line 143, in get_template
template, origin = self.find_template(template_name)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\engine.py", line 125, in find_template
template = loader.get_template(name, skip=skip)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loaders\base.py", line 18, in get_template
for origin in self.get_template_sources(template_name):
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\template\loaders\filesystem.py", line 36, in get_template_sources
name = safe_join(template_dir, template_name)
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\_os.py", line 17, in safe_join
final_path = abspath(join(base, *paths))
File "C:\Users\popec\AppData\Local\Programs\Python\Python38-32\lib\ntpath.py", line 78, in join
path = os.fspath(path)
Exception Type: TypeError at /
Exception Value: expected str, bytes or os.PathLike object, not list
有什么建议吗?谢谢:)
目前没有回答
相关问题 更多 >
编程相关推荐