I have a flask app with multiple blurprints. They are auth,admin,user,sample,data
.
While registering blueprints I added url_prefix for admin
blueprint. But I like to keep the url prefix as admin
even if the user(admin user) is accessing any views other than auth
also to keep user
as url prefix for all views accessed by ordinary user ,other than for auth
.
@admin.route('/dashboard')
def index():
return render_template('dashboard.html')
this will give me : localip:5000/admin/dashboard
But I need to have localip:5000/admin/sample
even if I am accessing view of a different blueprint.
@admin.route('/sample')
def samples():
return redirect(url_for('sample.index'))
@sample.route('/sample')
def index():
return render_template('sample.html')
Now I am getting localip:5000/sample
But I need localip:5000/admin/sample
or localip:5000/user/sample
based on user role.