How can i both register blueprint and add that app to flask-admin How can i both register blueprint and add that app to flask-admin flask flask

How can i both register blueprint and add that app to flask-admin


If you have a blueprint that has a name of users already then your 'admin' blueprint for your admin users model view needs to be called something different.
You can achieve this with the endpoint var in ModelViewFlask-Admin - ModelView

admin.add_view(ModelView(Users, db.session, endpoint="users_"))


You can also override the admin blueprint names in a ModelView subclass:

from flask_admin.contrib.sqla import ModelViewclass AppModelView(ModelView):    def create_blueprint(self, admin):        blueprint = super(AppModelView, self).create_blueprint(admin)        blueprint.name = '{}_admin'.format(blueprint.name)        return blueprint    def get_url(self, endpoint, **kwargs):        if not (endpoint.startswith('.') or endpoint.startswith('admin.')):            endpoint = endpoint.replace('.', '_admin.')        return super(AppModelView, self).get_url(endpoint, **kwargs)


The collision is because you have a module name user and a blueprint called user. Rename the blueprint to user_blueprint. From the code it seems you have a folder called user, a module called user and a blueprint called user. You can avoid problems later on with some descriptive names. Otherwise it is just plain confusing.