我正在尝试将文件保存到我的静态文件夹中,并在 ubuntu 20.4 上运行 flask 到以下目录:/var/www/webApp/webApp/static/temp/3.png' 当我尝试保存它时,出现以下错误日志:
[wsgi:error] [pid 1696:tid 139769597695744] [client xxxxxxxxxxx] PermissionError: [Errno 13] Permission denied: '/var/www/webApp/webApp/static/temp/3.png', referer: http://xx.xx.xxx.xx/upload
我已将文件夹 premission 设置为 777,并且在 webapp.conf 文件夹中我有以下代码:
<VirtualHost *:80> ServerName 34.65.173.45 ServerAdmin email@mywebsite.com WSGIScriptAlias / /var/www/webApp/webapp.wsgi <Directory /var/www/webApp/webApp/> Order allow,deny Allow from all </Directory> Alias /static /var/www/webApp/webApp/static <Directory /var/www/webApp/webApp/static/> Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined
我使用以下代码保存我的文件:
file.save(os.path.join(app.root_path, 'static', 'temp', filename))
这在本地主机上工作。
有人可以帮忙吗?谢谢
智慧大石
相关分类