我尝试了前面提到的针对同一错误问题的解决方案,但没有一个对我有用。
这是在命令提示符下显示的内容:
(env) C:\Users\Desktop\flask>flask run
* Environment: production
WARNING: This is a development server. Do not use it in a production deployme
nt.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
[2020-05-22 00:58:14,437] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
File "c:\users\desktop\flask\env\lib\site-packages\flask\app.py", line 24
47, in wsgi_app
response = self.full_dispatch_request()
File "c:\users\desktop\flask\env\lib\site-packages\flask\app.py", line 19
52, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\users\desktop\flask\env\lib\site-packages\flask\app.py", line 18
21, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\users\desktop\flask\env\lib\site-packages\flask\_compat.py", lin
e 39, in reraise
raise value
File "c:\users\desktop\flask\env\lib\site-packages\flask\app.py", line 19
50, in full_dispatch_request
rv = self.dispatch_request()
File "c:\users\desktop\flask\env\lib\site-packages\flask\app.py", line 19
36, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "C:\Users\Desktop\flask\app.py", line 9, in index
return render_template('index.html')
File "c:\users\desktop\flask\env\lib\site-packages\flask\templating.py",
line 138, in render_template
ctx.app.jinja_env.get_or_select_template(template_name_or_list),
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\environment.py"
, line 930, in get_or_select_template
return self.get_template(template_name_or_list, parent, globals)
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\environment.py"
, line 883, in get_template
return self._load_template(name, self.make_globals(globals))
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\environment.py"
, line 857, in _load_template
template = self.loader.load(self, name, globals)
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\loaders.py", li
ne 127, in load
code = environment.compile(source, name, filename)
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\environment.py"
, line 638, in compile
self.handle_exception(source=source_hint)
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\environment.py"
, line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "c:\users\desktop\flask\env\lib\site-packages\jinja2\_compat.py", li
ne 28, in reraise
raise value.with_traceback(tb)
File "C:\Users\Udai\Desktop\flask\templates\index.html", line 1, in template
<!--{%extends 'base.html%'}
jinja2.exceptions.TemplateSyntaxError: unexpected '}'
127.0.0.1 - - [22/May/2020 00:58:14] "←[35m←[1mGET / HTTP/1.1←[0m" 500 -
当我运行调试器时,它向我显示了以下内容: ] jinja2.exceptions.TemplateNotFound:index.html
回溯(最近通话最近一次)
我尝试过 app = Flask( name ,template_folder ='.. / templates')和 app = Flask( name ,template_folder ='.. / templates',static_folder ='.. / static')和 这个应用程式= Flask(名称,template_folder ='template')
但没有一个对我有用。
我该如何解决以上问题?