In templates/errors/404.html, it sets Back to point to index, which doesn't exist in the controllers. So this will cause the traceback below:
Traceback (most recent call last):
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 2309, in __call__
return self.wsgi_app(environ, start_response)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 2295, in wsgi_app
response = self.handle_exception(e)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 1741, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 1713, in handle_user_exception
return self.handle_http_exception(e)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 1644, in handle_http_exception
return handler(e)
File "/mnt/c/Users/liuji/Documents/flask-blog/flask-boilerplate/app.py", line 104, in not_found_error
return render_template('errors/404.html'), 404
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/templating.py", line 135, in render_template
context, ctx.app)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/templating.py", line 117, in _render
rv = template.render(context)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
return original_render(self, *args, **kwargs)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
return self.environment.handle_exception(exc_info, True)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
reraise(exc_type, exc_value, tb)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
raise value.with_traceback(tb)
File "/mnt/c/Users/liuji/Documents/flask-blog/flask-boilerplate/templates/errors/404.html", line 1, in top-level template code
{% extends 'layouts/main.html' %}
File "/mnt/c/Users/liuji/Documents/flask-blog/flask-boilerplate/templates/layouts/main.html", line 92, in top-level template code
{% block content %}{% endblock %}
File "/mnt/c/Users/liuji/Documents/flask-blog/flask-boilerplate/templates/errors/404.html", line 5, in block "content"
<p><a href="{{url_for('index')}}">Back</a></p>
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/helpers.py", line 356, in url_for
return appctx.app.handle_url_build_error(error, endpoint, values)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/app.py", line 2061, in handle_url_build_error
reraise(exc_type, exc_value, tb)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/_compat.py", line 35, in reraise
raise value
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/flask/helpers.py", line 345, in url_for
force_external=external)
File "/home/jibin/miniconda3/envs/flask-bp/lib/python3.7/site-packages/werkzeug/routing.py", line 1776, in build
raise BuildError(endpoint, values, method, self)
werkzeug.routing.BuildError: Could not build url for endpoint 'index'. Did you mean 'login' instead?
Change index to about in templates/errors/404.html will resolve this issue.
In
templates/errors/404.html
, it setsBack
to point toindex
, which doesn't exist in the controllers. So this will cause the traceback below:Change
index
toabout
intemplates/errors/404.html
will resolve this issue.