Answer the question
In order to leave comments, you need to log in
PermissionError: [Errno 13] Apache python, how to fix?
I know, there have already been many questions about this error, but I did not find a solution to my problem.
def log_write(text: str) -> None:
with open("logging.log", "a") as log:
log.write(str(text))
[wsgi:error] PermissionError: [Errno 13] Permission denied: 'logging.log'
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
drwxrwxrwx 3 www-data www-data 4096 Aug 27 23:56 .
drwxrwxrwx 3 www-data www-data 4096 Aug 27 19:31 ..
-rwxrwxrwx 1 www-data www-data 2094 Aug 27 21:17 __init__.py
drwxrwxrwx 3 www-data www-data 4096 Aug 27 19:31 .
drwxrwxrwx 4 www-data www-data 4096 Aug 27 19:23 ..
drwxrwxrwx 3 www-data www-data 4096 Aug 27 23:56 webApp
-rwxrwxrwx 1 www-data www-data 198 Aug 27 15:45 webapp.wsgi
#!/usr/bin/python
import sys
import logging
logging.basicConfig(stream=sys.stderr)
sys.path.insert(0,"/var/www/webApp/")
from webApp import app as application
application.secret_key = 'key'
<VirtualHost *:80>
ServerName 185.251.91.76
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
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question