I'm looking at https://github.com/ibininja/upload_file_python . I'm working in win 7 with pycharm 2017. The main code contains:
@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)
I'd like to debug this in pycharm. I can debug the '/' route as in the screenshot. How do I debug a specific flask route like "/upload" ?
You can place a break point at folder_name = request.form['superhero']. Run your whole project in debug mode and when you request the endpoint through postman(its a tool for testing endpoints) you can see your code will stop at that break point.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.