{"id":258,"hash":"a76343841e975728be4fa050ba04ae008198cd2d6e43887cc6f152f7d3c91e00","pattern":"AssertionError: View function mapping is overwriting an existing endpoint function: main","full_message":"Does anyone know why I can't overwrite an existing endpoint function if i have two url rules like this\n\napp.add_url_rule('/',\n                 view_func=Main.as_view('main'),\n                 methods=[\"GET\"])\n\napp.add_url_rule('/<page>/',\n                 view_func=Main.as_view('main'),\n                 methods=[\"GET\"])\n\nTraceback:\n\nTraceback (most recent call last): \n  File \"demo.py\", line 20, in <module> methods=[\"GET\"]) \n  File \".../python2.6/site-packages/flask‌​/app.py\", \n    line 62, in wrapper_func return f(self, *args, **kwargs) \n  File \".../python2.6/site-packages/flask‌​/app.py\", \n    line 984, in add_url_rule 'existing endpoint function: %s' % endpoint)  \nAssertionError: View function mapping is overwriting an existing endpoint \n    function: main","ecosystem":"pypi","package_name":"flask","package_version":null,"solution":"Your view names need to be unique even if they are pointing to the same view method.\n\napp.add_url_rule('/',\n                 view_func=Main.as_view('main'),\n                 methods = ['GET'])\n\napp.add_url_rule('/<page>/',\n                 view_func=Main.as_view('page'),\n                 methods = ['GET'])","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/17256602/assertionerror-view-function-mapping-is-overwriting-an-existing-endpoint-functi","votes":158,"created_at":"2026-04-19T04:41:39.774197+00:00","updated_at":"2026-04-19T04:51:51.427237+00:00"}