Jinja 2 Error
Gizmotronn opened this issue · 2 comments
Gizmotronn commented
After cloning this repo into an empty directory on my laptop running OSX Big Sur (2020), Python 3.8.2 and Visual Studio Code, I ran the application following the instructions in the documentation, resulting in this Jinja2 error:
jinja2.exceptions.UndefinedError
jinja2.exceptions.UndefinedError: 'segment' is undefined
Traceback (most recent call last)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
response = self.handle_exception(e)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/app/base/routes.py", line 65, in register
return render_template( 'accounts/register.html',
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/templating.py", line 137, in render_template
return _render(
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/flask/templating.py", line 120, in _render
rv = template.render(context)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/jinja2/environment.py", line 1289, in render
self.environment.handle_exception()
File "/Users/liam/Documents/Webapps/material-dashboard-flask/venv/lib/python3.8/site-packages/jinja2/environment.py", line 924, in handle_exception
raise rewrite_traceback_stack(source=source)
File "/Users/liam/Documents/Webapps/material-dashboard-flask/app/base/templates/accounts/register.html", line 1, in top-level template code
{% extends "layouts/base.html" %}
File "/Users/liam/Documents/Webapps/material-dashboard-flask/app/base/templates/layouts/base.html", line 46, in top-level template code
{% include 'includes/sidebar.html' %}
File "/Users/liam/Documents/Webapps/material-dashboard-flask/app/base/templates/includes/sidebar.html", line 13, in top-level template code
<li class="nav-item {% if 'index' in segment %} active {% endif %}">
jinja2.exceptions.UndefinedError: 'segment' is undefined
The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.
To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.
You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:
dump() shows all variables in the frame
dump(obj) dumps all that's known about the object
This resulted after trying to sign a user up
app-generator commented
Hello @Gizmotronn
Please update to the latest revision and re-install the app (clean install).
Jinja2 was freezed in the req
file to jinja2==2.11.3
Let us know the results.
app-generator commented
Hello @Gizmotronn,
Thank you for reporting this issue.
Please use the latest release v1.0.3
Let us know your progress.