i'm trying to run a flask app using the flask breadcrumb extension. but this error is being raised.
Error on request:
Traceback (most recent call last):
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\serving.py", line 364, in run_wsgi
execute(self.server.app)
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\serving.py", line 325, in execute
application_iter = app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2552, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2532, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
self.ensure_sync(func)()
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_menu\decorators.py", line 80, in _register_menu_item
item = current_menu.submenu(str(path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\local.py", line 311, in __get__
obj = instance._get_current_object()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\local.py", line 515, in _get_current_object
return get_name(local())
^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_menu\ext.py", line 50, in root
return current_app.extensions["menu"].root_node
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Breadcrumbs' object has no attribute 'root_node'
Error on request:
Traceback (most recent call last):
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\serving.py", line 364, in run_wsgi
execute(self.server.app)
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\serving.py", line 325, in execute
application_iter = app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2552, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2532, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 2529, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask\app.py", line 1815, in full_dispatch_request
self.ensure_sync(func)()
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_menu\decorators.py", line 80, in _register_menu_item
item = current_menu.submenu(str(path))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\local.py", line 311, in __get__
obj = instance._get_current_object()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\werkzeug\local.py", line 515, in _get_current_object
return get_name(local())
^^^^^^^^
File "C:\Users\Cayo\AppData\Local\Programs\Python\Python311\Lib\site-packages\flask_menu\ext.py", line 50, in root
return current_app.extensions["menu"].root_node`
i really don't understand.
that's the python code
from flask import Flask, render_template
from flask_breadcrumbs import Breadcrumbs, register_breadcrumb
app = Flask(__name__)
# Initialize Flask-Breadcrumbs
Breadcrumbs(app=app)
@app.route('/')
@register_breadcrumb(app, '.', 'Home')
def index():
return render_template('index.html')
if __name__ == '__main__':
app.run(debug=True)
that's the html
<!DOCTYPE html>
<html>
<head>
<title>Get Selected Option</title>
</head>
<body>
<div>
{%- for breadcrumb in breadcrumbs -%}
<a href="{{ breadcrumb.url }}">{{ breadcrumb.text }}</a>
{{ '/' if not loop.last }}
{%- endfor -%}
</div>
</body>
</html>