pallets-eco / flask-debugtoolbar

A toolbar overlay for debugging Flask applications
https://flask-debugtoolbar.readthedocs.io
BSD 3-Clause "New" or "Revised" License
953 stars 146 forks source link

What endpoint in flask-debugtoolbar am i overwriting? #91

Closed ghost closed 8 years ago

ghost commented 8 years ago
(ma)➜  flask-mega-tutorial git:(master) ✗ python runserver.py
Did not find settings file settings.py for additional settings, skipping it
Did not find settings file development.py for additional settings, skipping it
Traceback (most recent call last):
  File "runserver.py", line 4, in <module>
    init_for('dev')
  File "/Users/sindhus/Documents/flask-mega-tutorial/myapp/__init__.py", line 30, in init_for
    toolbar = DebugToolbarExtension(app)
  File "/Users/sindhus/Documents/flask-mega-tutorial/ma/lib/python2.7/site-packages/flask_debugtoolbar/__init__.py", line 58, in __init__
    self.init_app(app)
  File "/Users/sindhus/Documents/flask-mega-tutorial/ma/lib/python2.7/site-packages/flask_debugtoolbar/__init__.py", line 82, in init_app
    '_debug_toolbar.static', self.send_static_file)
  File "/Users/sindhus/Documents/flask-mega-tutorial/ma/lib/python2.7/site-packages/flask/app.py", line 62, in wrapper_func
    return f(self, *args, **kwargs)
  File "/Users/sindhus/Documents/flask-mega-tutorial/ma/lib/python2.7/site-packages/flask/app.py", line 984, in add_url_rule
    'existing endpoint function: %s' % endpoint)
AssertionError: View function mapping is overwriting an existing endpoint function: _debug_toolbar.static

This happens when I enable the debugtoolbar. I only have / for index, /add and /delete routes.

Thanks!

ghost commented 8 years ago

Figured it out! One of the dependent libraries already brought in Flask-Debugtoolbar so I didn't have to manually initialise it again :)

mgood commented 8 years ago

Oh glad you figured it out. What library was it? That is confusing and doesn't seem like something that should typically be done in a library for just this reason.

ghost commented 8 years ago

baseframe is a library that has utilities and static assets required for my company HasGeek's projects. I had requested for availability of Flask-DebugToolbar across all HasGeek projects and it was included. Later when I was coding my own hobby project I tried to enable Flask-DebugToolbar when I was already using Baseframe :)