Why I get this error when tried to use rendering:
Traceback (most recent call last):
File "d:\Projects\jara.md\backend\flask\__init__.py", line 31, in <module>
@app.route('/update/<int:adv_id>', methods=['PUT'])
File "c:\Python27\lib\site-packages\flask\app.py", line 1080, in decorator
self.add_url_rule(rule, endpoint, f, **options)
File "c:\Python27\lib\site-packages\flask\app.py", line 64, in wrapper_func
return f(self, *args, **kwargs)
File "c:\Python27\lib\site-packages\flask\app.py", line 1051, in add_url_rule
'existing endpoint function: %s' % endpoint)
AssertionError: View function mapping is overwriting an existing endpoint function: start
Code list is:
app = Flask(__name__)
@app.route('/add', methods=['POST'])
def add():
return 'Add'
@app.route('/start/<int:adv_id>', methods=['PUT'])
def start(adv_id):
return 'start'
### Rendering ###
@app.route('/add', methods=['GET'])
def add():
return render_template('add.html')
if __name__ == "__main__":
app.run()
As you can see I have two methods add()
for GET and POST requests.
What does this message mean?
self.add_url_rule(rule, endpoint, f, **options)
@app.route('/update/<int:adv_id>', methods=['PUT'])
def start(adv_id):
return 'update'