[英]How to debug a flask route with pycharm
我在看https://github.com/ibininja/upload_file_python 。 我正在使用pycharm 2017在win 7中工作。主要代码包含:
@app.route("/upload", methods=["POST"])
def upload():
folder_name = request.form['superhero']
'''
# this is to verify that folder to upload to exists.
if os.path.isdir(os.path.join(APP_ROOT, 'files/{}'.format(folder_name))):
print("folder exist")
'''
target = os.path.join(APP_ROOT, 'files/{}'.format(folder_name))
print(target)
我想在pycharm中调试它。 我可以如屏幕截图所示调试“ /”路由。 如何调试特定的烧瓶路径,例如“ / upload”?
您可以在folder_name = request.form ['superhero']处放置一个断点。 在调试模式下运行整个项目,当您通过postman(用于测试端点的工具)请求端点时,您会看到代码将在该断点处停止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.