I'm running flask on mod_wsgi. my flask app, which is on /var/www/app
receives some file from user and saves it to /var/www/app/tmp
directory. However even after all chmod and chown(thought it was a permission problem), I was unable to reach that tmp directory.
After some debugging I found out that the current working directory of the flask app is /
.
I can change working directory by os.chdir('/var/www/')
, but I'd like to avoid that for security concerns.
here is my apache configuration:
<VirtualHost *:80>
ServerName mysite.com
ServerAlias site.com
ServerAdmin admin@localhost
WSGIDaemonProcess app user=www-data group=www-data processes=1
WSGIScriptAlias / /var/www/app.wsgi
Alias /static /var/www/app/static
<Directory /var/www/app>
WSGIProcessGroup app
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Order deny,allow
Allow from all
</Directory>
<Location "/static">
SetHandler None
</Location>
</VirtualHost>
How can I change working directory of my app from /
to /var/www
?