Traceback (most recent call last):
File "short_url_app.py", line 20, in <module>
@app.route('shorten', methods=['POST'])
File "C:\Users\allar\Envs\python3\lib\site-packages\flask\app.py", line 1314, in dec
orator
self.add_url_rule(rule, endpoint, f, **options)
File "C:\Users\allar\Envs\python3\lib\site-packages\flask\app.py", line 98, in wrapp
er_func
return f(self, *args, **kwargs)
File "C:\Users\allar\Envs\python3\lib\site-packages\flask\app.py", line 1274, in add
_url_rule
rule = self.url_rule_class(rule, methods=methods, **options)
File "C:\Users\allar\Envs\python3\lib\site-packages\werkzeug\routing.py", line 641,
in __init__
raise ValueError("urls must start with a leading slash")
ValueError: urls must start with a leading slash
ValueError: urls must start with a leading slash
意思是
ValueError: url必须以斜杠开头
@app.route('shorten', methods=['POST'])
修改成:
@app.route('/shorten', methods=['POST'])
再次启动可以正常运行。
还没有评论,来说两句吧...