python - Flask use the same blueprint across files -
this project structure:
- app.py - views/ - admin/ - __init__.py - note.py - album.py in views/admin/__init__.py created blueprint:
admin_bp = blueprint('admin_bp', __name__, url_prefix='/admin')
and i'd use blueprint in both note.py , album.py
what i've tried:
# note.py views.admin import admin_bp @admin_bp.route('/note/list') def list_notes(): pass but seems url rule not generated @ all
thanks.
are loading blueprint in app.py?
from admin import admin_bp app.register_blueprint(admin_bp) ensure importing note.py & album.py inside admin/__init__.py.
this should load urls.
if fails may worth printing contents of url map:
print app.url_map regards
Comments
Post a Comment