remoteinterview / zero

Zero is a web server to simplify web development.

Home Page:https://zeroserver.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python flask render_template

blackshot opened this issue · comments

i tried to use flask built-in render_template function to return some html with no success.

it seems like it cannot find the template/templates folder.

Traceback (most recent call last):
  File "C:\Program Files\nodejs\node_modules\zero\node_modules\zero-handler-python\entryfile.py", line 39, in root
    return module.handler(*args, **kwargs)
  File "C:/Users/me/Desktop/proyectos/zero/prueba\test.py", line 4, in handler
    return render_template('prueba.html')
  File "C:\Python39\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\me\AppData\Roaming\Python\Python39\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\me\AppData\Roaming\Python\Python39\site-packages\jinja2\environment.py", line 883, in get_template
    return self._load_template(name, self.make_globals(globals))
  File "C:\Users\me\AppData\Roaming\Python\Python39\site-packages\jinja2\environment.py", line 857, in _load_template
    template = self.loader.load(self, name, globals)
  File "C:\Users\me\AppData\Roaming\Python\Python39\site-packages\jinja2\loaders.py", line 115, in load
    source, filename, uptodate = self.get_source(environment, name)
  File "C:\Python39\lib\site-packages\flask\templating.py", line 60, in get_source
    return self._get_source_fast(environment, template)
  File "C:\Python39\lib\site-packages\flask\templating.py", line 89, in _get_source_fast
    raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: prueba.html
[2021-02-03 17:29:02,216] ERROR in app: Exception on /test/ [GET]
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\flask\app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Python39\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    return self.finalize_request(rv)
  File "C:\Python39\lib\site-packages\flask\app.py", line 1967, in finalize_request
    response = self.make_response(rv)
  File "C:\Python39\lib\site-packages\flask\app.py", line 2096, in make_response
    raise TypeError(
TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.