title: AssertionError: A blueprint's name collision occurred
body: <p><a href="https://i.stack.imgur.com/gdXiE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gdXiE.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to extend the flask-base project <a href="https://github.com/hack4impact/flask-base/tree/master/app" rel="nofollow noreferrer">https://github.com/hack4impact/flask-base/tree/master/app</a>. This uses the the application factory pattern in app/init.py and blueprints.</p>
  
  <p>I'm struggling to get the most basic functionality working so now I'm trying to follow <a href="https://flask-admin.readthedocs.io/en/v1.1.0/_sources/quickstart.txt" rel="nofollow noreferrer">https://flask-admin.readthedocs.io/en/v1.1.0/_sources/quickstart.txt</a></p>
  
  <p>In the app/init.py I have:</p>
  
  <pre><code>from flask_admin import Admin
  
  
  ....
  adm = Admin(name='admin2')
  
  
  def create_app(config_name):
      app = Flask(__name__)
      app.config.from_object(config[config_name])
      app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
      # not using sqlalchemy event system, hence disabling it
  
      config[config_name].init_app(app)
  ....
      RQ(app)
      adm.init_app(app)   
  ...
  
  from .admin import admin as admin_blueprint
  app.register_blueprint(admin_blueprint, url_prefix='/admin')
  
  return app
  </code></pre>
  
  <p>templates/admin/db.html:</p>
  
  <pre><code>&lt;p&gt;Hello world&lt;/p&gt;
  </code></pre>
  
  <p>To the admin views (<a href="https://github.com/hack4impact/flask-base/blob/master/app/admin/views.py" rel="nofollow noreferrer">https://github.com/hack4impact/flask-base/blob/master/app/admin/views.py</a>) I've added :</p>
  
  <pre><code>from flask_admin import Admin, BaseView, expose
  from flask_admin.contrib.sqla import ModelView
  from app import adm, db
  
  class MyView(ModelView):
      @expose('/')
      # @login_required
      def db(self):
          return self.render('admin/db.html')
  
  
  adm.add_view(MyView(User, db.session))
  </code></pre>
  
  <p>When I open:</p>
  
  <pre><code> 127.0.0.1:5000/db
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>AssertionError: A blueprint's name collision occurred between &lt;flask.blueprints.Blueprint object at 0x000000000586C6D8&gt; and &lt;flask.blueprints.Blueprint object at 0x00000000055AFE80&gt;.  Both share the same name "admin".  Blueprints that are created on the fly need unique names.
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>edit:</p>
  
  <p>following your advice I changed to:</p>
  
  <pre><code>adm = Admin(name='admin2',endpoint='/db')
  </code></pre>
  
  <p>However if I try:</p>
  
  <pre><code> 127.0.0.1:5000/db/db
  </code></pre>
  
  <p>I get a 404. I'm assuming you are changing the normal base admin route from 'admin'to 'db'</p>
  
  <p>What now?</p>