I am using Flask App builder to make a basic webpage. I want to change the default landing page based on the user logged in e.g. user1 should be redirected to /home/user1 page and user2 should login to /home/general page etc after they logged in.
Below is my custom index view
class MyIndexView(IndexView):
index_template = 'index.html'
@expose('/')
def main(self):
return redirect(url_for('AuthDBView.login'))
@expose('/index')
def index(self):
return self.render_template('index.html', message="Welcome to my website")
and starting the app by calling
appbuilder = AppBuilder(app, db.session, indexview=MyIndexView)
I have not seen any example or documentation on how to achieve this. so appreciate any help