AssertionError: View function mapping is overwriting an existing endpoint function: main
Full error message
Does anyone know why I can't overwrite an existing endpoint function if i have two url rules like this
app.add_url_rule('/',
view_func=Main.as_view('main'),
methods=["GET"])
app.add_url_rule('/<page>/',
view_func=Main.as_view('main'),
methods=["GET"])
Traceback:
Traceback (most recent call last):
File "demo.py", line 20, in <module> methods=["GET"])
File ".../python2.6/site-packages/flask/app.py",
line 62, in wrapper_func return f(self, *args, **kwargs)
File ".../python2.6/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: mainSolutionsource: stackoverflow \u2197
Your view names need to be unique even if they are pointing to the same view method. app.add_url_rule('/', view_func=Main.as_view('main'), methods = ['GET']) app.add_url_rule('/<page>/', view_func=Main.as_view('page'), methods = ['GET'])
API access
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/a76343841e975728be4fa050ba04ae008198cd2d6e43887cc6f152f7d3c91e00hash \u00b7 a76343841e975728be4fa050ba04ae008198cd2d6e43887cc6f152f7d3c91e00