I guess that I should set a noob question alert on top. I am trying to deploy two Django projects locally with Apache and SQLite using mod_wsgi. Everything works fine, but I cannot figure out how to properly configure the permissions to my folders locally. Most of the relevant tutorials or posts treat the issue insufficiently or are quite difficult for me to understand. I have to say that I am using ubuntu 18.04.
My current permissions are set by
chmod -R 755 /var/www/env1
which is the parent directory of the project and also contains my virtual environment (using VirtualEnv). However, I understand that this is not the way to go, because I can directly download my .py files from the browser. This is the result of 'ls -la' inside the env1 folder.
drwxr-sr-x+ 10 www-data www-data 4096 Φεβ 5 21:10 .
drwxrwsr-x+ 3 www-data www-data 4096 Φεβ 1 12:39 ..
drwxr-sr-x+ 9 www-data www-data 4096 Ιαν 26 00:05 astronomy
drwxr-sr-x+ 3 www-data www-data 4096 Φεβ 1 13:43 bin
drwxr-sr-x+ 9 www-data www-data 4096 Ιαν 26 00:05 gastronomy
drwxr-sr-x+ 2 www-data www-data 4096 Ιαν 25 16:46 include
drwxr-sr-x+ 3 www-data www-data 4096 Ιαν 25 16:46 lib
drwxr-sr-x+ 2 www-data www-data 4096 Φεβ 1 12:33 media
"astronomy" and "gastronomy" are my two project folders. Is there a way that the apache server will run locally but there will be accessible only by root users? My projects include a media folder where users are supposed to be able to upload image files, which I think is an extra issue concerning permissions.
I would really appreciate any advice or solution to understand what is the way to go. Thank you very much in advance.