Install & Compatibility
Where this runs
tested against v2.0.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.494s · 22.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.2s · import 0.476s · 23MB
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Menu
✓ from flask_menu import Menu
✗ from flask.ext.menu import Menu
Flask-Ext pattern was removed in Flask 2.0
register_menu
✓ from flask_menu import register_menu
Initialize the Menu extension and register a menu entry on a view function.
from flask import Flask
from flask_menu import Menu, register_menu
app = Flask(__name__)
Menu(app)
@app.route('/')
@register_menu(app, '.index', 'Home', order=0)
def index():
return 'Hello'
if __name__ == '__main__':
app.run()
Errors
Common errors & fixes
ImportError: cannot import name 'Menu' from 'flask.ext.menu'
Using the deprecated Flask-Ext import style.
fixUse `from flask_menu import Menu` instead.
RuntimeError: The menu entry '...' is not registered because the endpoint '...' does not exist.
The decorator `@register_menu` is applied after the route decorator, or the view function is not defined.
fixEnsure `@register_menu` is placed directly above `@app.route` and that the endpoint matches the route's endpoint.
Upgrade
Version history
2.0.0latest on PyPI · released Nov 21, 2024
Audit
Dependencies
FlaskrequiredRequired as the framework