FileNotFoundError: [Errno 2] No such file or directory的解决方法
1.获取当前文件所在路径
basedir = os.path.dirname(__file__)
print("basedir:" + basedir)
2.将路径进行拼接
upload_path = os.path.join(basedir, "static/upload", filename)
zengsf 懒惰、高效、实用
1.获取当前文件所在路径
basedir = os.path.dirname(__file__)
print("basedir:" + basedir)
2.将路径进行拼接
upload_path = os.path.join(basedir, "static/upload", filename)