【发布时间】:2021-04-13 11:32:46
【问题描述】:
我在 Ubuntu 的 Apache2 服务器上运行 Flask 应用程序。该应用程序将从表单中获取输入并将其保存到文本文件中。该文件仅在上传到 S3 时存在。之后它就被删除了。:
foodforthought = request.form['txtfield']
with open("filetos3.txt", "w") as file:
file.write(foodforthought)
file.close()
s3.Bucket("bucketname").upload_file(Filename = "filetos3.txt", Key = usr+"-"+str(datetime.now()))
os.remove("filetos3.txt")
但应用无权创建文件:
[Errno 13] Permission denied: 'filetos3.txt'
我已经尝试授予应用所在文件夹的权限:
sudo chmod -R 777 /var/www/webApp/webApp
但它不起作用
【问题讨论】:
-
你检查所有权了吗?尝试从 root 用户运行它。
标签: python linux apache ubuntu amazon-s3