Reputation: 272
I am trying to save a file to my static folder with flask running on ubuntu 20.4 to the following directory: /var/www/webApp/webApp/static/temp/3.png' When I try to save it gives me the following error log:
[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
I have set the folder premission to 777, and in the webapp.conf folder I have the following code:
<VirtualHost *:80>
ServerName 34.65.173.45
ServerAdmin [email protected]
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
I save my file with the following code:
file.save(os.path.join(app.root_path, 'static', 'temp', filename))
This is working on local host.
Can someone help? Thanks
Upvotes: 0
Views: 5126
Reputation: 307
Can you go to the project folder /var/www/webApp/webApp/ and run
sudo chmod 777 -Rv static
Upvotes: 2