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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -