from flask import Flask,request
app=Flask(__name__)
@app.route('./index')
def index():
return '666'
app.run()
报错:ValueError: urls must start with a leading slash
原因:装饰器路由上多加了个’ . ’
2.在linux写的服务,莫名其妙的就启动不了原因是虚拟机前面带了个base字样的时候,前一天还是好的,然后发现是werkzeug 版本原因0.15.5中修复。从0.15.4升级到更高版本。
127.0.0.1 - - [09/Feb/2020 12:43:40] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
File "/projects/env/lib/python3.8/site-packages/flask/_compat.py", line 36, i
n reraise
raise value
File "/projects/NewTest.py", line 3, in <module>
app = Flask(__name__)
File "/projects/env/lib/python3.8/site-packages/flask/app.py", line 559, in _
_init__
self.add_url_rule(
File "/projects/env/lib/python3.8/site-packages/flask/app.py", line 67, in wr
apper_func
return f(self, *args, **kwargs)
File "/projects/env/lib/pytho