Pages : 1
#1 Le 27/08/2019, à 13:30
- paascaal
Apache2 Django : erreur 500 Internal Server Error
Bonjour,
Depuis une mise à jour du fichier settings.py de mon projet Django en production, hébergé sur un serveur Ubuntu 18.04.3, le site Internet produit une erreur 500.
Voici la fin du fichier error.log d'Apache :
[Tue Aug 27 14:03:05.292095 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] mod_wsgi (pid=32213): Target WSGI script '/var/www/eedfalbi/eedfalbi/eedfalbi/wsgi.py' cannot be loaded as Python module.
[Tue Aug 27 14:03:05.292319 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] mod_wsgi (pid=32213): Exception occurred processing WSGI script '/var/www/eedfalbi/eedfalbi/eedfalbi/wsgi.py'.
[Tue Aug 27 14:03:05.298767 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] Traceback (most recent call last):
[Tue Aug 27 14:03:05.298987 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/config.py", line 565, in configure
[Tue Aug 27 14:03:05.299019 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] handler = self.configure_handler(handlers[name])
[Tue Aug 27 14:03:05.299069 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/config.py", line 738, in configure_handler
[Tue Aug 27 14:03:05.299092 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] result = factory(**kwargs)
[Tue Aug 27 14:03:05.299139 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/__init__.py", line 1032, in __init__
[Tue Aug 27 14:03:05.299163 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] StreamHandler.__init__(self, self._open())
[Tue Aug 27 14:03:05.299209 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/__init__.py", line 1061, in _open
[Tue Aug 27 14:03:05.299232 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] return open(self.baseFilename, self.mode, encoding=self.encoding)
[Tue Aug 27 14:03:05.299333 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] PermissionError: [Errno 13] Permission denied: '/debug.log'
[Tue Aug 27 14:03:05.299394 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262]
[Tue Aug 27 14:03:05.299421 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] During handling of the above exception, another exception occurred:
[Tue Aug 27 14:03:05.299441 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262]
[Tue Aug 27 14:03:05.299488 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] Traceback (most recent call last):
[Tue Aug 27 14:03:05.299688 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/var/www/eedfalbi/eedfalbi/eedfalbi/wsgi.py", line 18, in <module>
[Tue Aug 27 14:03:05.299714 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] application = get_wsgi_application()
[Tue Aug 27 14:03:05.299762 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/var/www/eedfalbi/eedfalbi/venv2/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
[Tue Aug 27 14:03:05.299785 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] django.setup(set_prefix=False)
[Tue Aug 27 14:03:05.299831 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/var/www/eedfalbi/eedfalbi/venv2/lib/python3.6/site-packages/django/__init__.py", line 19, in setup
[Tue Aug 27 14:03:05.299855 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
[Tue Aug 27 14:03:05.299901 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/var/www/eedfalbi/eedfalbi/venv2/lib/python3.6/site-packages/django/utils/log.py", line 76, in configure_logging
[Tue Aug 27 14:03:05.299925 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] logging_config_func(logging_settings)
[Tue Aug 27 14:03:05.299970 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/config.py", line 802, in dictConfig
[Tue Aug 27 14:03:05.300023 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] dictConfigClass(config).configure()
[Tue Aug 27 14:03:05.300070 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] File "/usr/lib/python3.6/logging/config.py", line 573, in configure
[Tue Aug 27 14:03:05.300091 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] '%r: %s' % (name, e))
[Tue Aug 27 14:03:05.300166 2019] [wsgi:error] [pid 32213] [remote 84.98.244.67:38262] ValueError: Unable to configure handler 'file': [Errno 13] Permission denied: '/debug.log'
Voici également mon fichier wsgi.py du projet Django :
import os, sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/var/www/eedfalbi')
sys.path.append('/var/www/eedfalbi/eedfalbi')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'eedfalbi.settings')
application = get_wsgi_application()
et la configuration d'Apache :
WSGIApplicationGroup %{GLOBAL}
WSGIDaemonProcess www.eedfalbi.fr processes=2 threads=15 display-name=%{GROUP} python-path=/var/www/eedfalbi/eedfalbi:/var/www/eedfalbi/eedfalbi/venv2/lib/python3.6/site-packages
WSGIProcessGroup www.eedfalbi.fr
<VirtualHost *:80>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName www.eedfalbi.fr
ServerAlias www.eedfalbi.fr
DocumentRoot /var/www/eedfalbi/eedfalbi
WSGIScriptAlias / /var/www/eedfalbi/eedfalbi/eedfalbi/wsgi.py
<Directory /var/www/eedfalbi/eedfalbi/>
AllowOverride all
Require all granted
Options FollowSymlinks
</Directory>
Alias /static/ /var/www/eedfalbi/eedfalbi/static/
<Directory /var/www/eedfalbi/eedfalbi/static>
Require all granted
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.eedfalbi.fr
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
<IfModule mod_ssl.c>
<VirtualHost *:443>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerName www.eedfalbi.fr
ServerAlias www.eedfalbi.fr
DocumentRoot /var/www/eedfalbi/eedfalbi
WSGIScriptAlias / /var/www/eedfalbi/eedfalbi/eedfalbi/wsgi.py
<Directory /var/www/eedfalbi/eedfalbi/>
AllowOverride all
Require all granted
Options FollowSymlinks
</Directory>
Alias /static/ /var/www/eedfalbi/eedfalbi/static/
<Directory /var/www/eedfalbi/eedfalbi/static>
Require all granted
</Directory>
SSLCertificateFile /etc/letsencrypt/live/www.eedfalbi.fr-0001/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/www.eedfalbi.fr-0001/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Est-il arrivé quelque chose de semblable à quelqu'un ? Comment y remédier ?
D'avance merci !
Dernière modification par paascaal (Le 27/08/2019, à 13:31)
Hors ligne
#2 Le 28/08/2019, à 03:30
- Vobul
Re : Apache2 Django : erreur 500 Internal Server Error
Salut,
À mon avis il faut donner des permissions correctes à "debug.log" :
PermissionError: [Errno 13] Permission denied: '/debug.log'
Vobul
Utilisez le retour utilisable de commandes !!!
J'aime la langue française, mais je parle franglais, deal with it.
RTFM
Hors ligne
Pages : 1