BTW, you shouldn't be setting: WSGIPythonPath "/usr/lib64/python3.7:/usr/lib64/python3.7/lib-dynload:/usr/lib64/python3.7/site-packages"
You do not need to include default locations. What you should be setting WSGIPythonPath to is the parent directory of where your Python project is. See the Django docs: https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/modwsgi/ <https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/modwsgi/> You should also look at using daemon mode of mod_wsgi. It is the recommended deployment method. > On 21 Aug 2019, at 10:24 am, Graham Dumpleton <[email protected]> > wrote: > > You don't actually show the exception details in the log that I can see. You > truncated it. It is the bit at the end of the traceback which is important as > that says what the exception is. > >> On 21 Aug 2019, at 10:20 am, Bob Bobsled <[email protected] >> <mailto:[email protected]>> wrote: >> >> Hi, >> I'm struggling badly with mod_wsgi, python3, and django on fedora30. Seems >> like everything is working alone, but I cannot get mod_wsgi to work with >> django, if that makes any sense. In other words my django app works from >> runserver, and I can see the whiskey image from mod_wsgi, and can serve a >> simple python script with mod_wsgi, but cannot get the django production >> server approach working for my app using mod_wsgi with httpd (apache). >> >> I've put my app (hawmusarchive) in several places to test such as >> /opt/hawmusarchive, or /var/www/hawmusarchive, or >> /var/www/html/hawmusarchive but all seem to get the internal server error so >> am appending httpd server log below which is showing issues with wsgi.py. >> I've checked permissions/ownership (777, apache:apache) on everything. >> >> I'm not using venev, and am wondering if django being in >> /usr/lib/python3.7/site-packages (32bit), and mod_wsgi installed in >> /usr/lib64/python3.7/site-packages (64 bit) is confusing it for some reason? >> >> I've worked thru my config.d file for wsgi alias, vhost carefully, and list >> it way below if somehow I buggered it to provoke the internal server error. >> >> Any help/hints very greatly appreciated on perhaps where to keep looking. >> >> Regards, >> bob >> >> EXCERPT from /var/log/httpd/error_logs: >> >> [Mon Aug 19 15:00:13.855666 2019] [mpm_event:notice] [pid 5992:tid >> 140091650494784] AH00489: Apache/2.4.39 (Fedora) mod_wsgi/4.6.4 Python/3.7 >> configured -- resuming normal operations >> [Mon Aug 19 15:00:13.855688 2019] [core:notice] [pid 5992:tid >> 140091650494784] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' >> [Mon Aug 19 15:00:18.768792 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] mod_wsgi (pid=5997): Failed to exec Python >> script file '/opt/hawmusarchive/hawmusarchive/wsgi.py'. >> [Mon Aug 19 15:00:18.768873 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] mod_wsgi (pid=5997): Exception occurred >> processing WSGI script '/opt/hawmusarchive/hawmusarchive/wsgi.py'. >> [Mon Aug 19 15:00:18.769468 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] Traceback (most recent call last): >> [Mon Aug 19 15:00:18.769557 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/opt/hawmusarchive/hawmusarchive/wsgi.py", line 16, in <module> >> [Mon Aug 19 15:00:18.769566 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] application = get_wsgi_application() >> [Mon Aug 19 15:00:18.769575 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib/python3.7/site-packages/django/core/wsgi.py", line 12, in >> get_wsgi_application >> [Mon Aug 19 15:00:18.769613 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] django.setup(set_prefix=False) >> [Mon Aug 19 15:00:18.769621 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib/python3.7/site-packages/django/__init__.py", line 19, in setup >> [Mon Aug 19 15:00:18.769626 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] >> configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) >> [Mon Aug 19 15:00:18.769633 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib/python3.7/site-packages/django/conf/__init__.py", line 57, in >> __getattr__ >> [Mon Aug 19 15:00:18.769637 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] self._setup(name) >> [Mon Aug 19 15:00:18.769650 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib/python3.7/site-packages/django/conf/__init__.py", line 44, in >> _setup >> [Mon Aug 19 15:00:18.769656 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] self._wrapped = Settings(settings_module) >> [Mon Aug 19 15:00:18.769673 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib/python3.7/site-packages/django/conf/__init__.py", line 107, in >> __init__ >> [Mon Aug 19 15:00:18.769677 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] mod = >> importlib.import_module(self.SETTINGS_MODULE) >> [Mon Aug 19 15:00:18.769684 2019] [wsgi:error] [pid 5997:tid >> 140091162883840] [client 128.171.51.150:41152 >> <http://128.171.51.150:41152/>] File >> "/usr/lib64/python3.7/importlib/__init__.py", line 127, in import_module >> >> --------------- >> >> >> # httpd conf.d file for django. >> # httpd.conf calls all conf.d files. >> >> ##LOAD MODULE >> #this one was the system dnf install mod_wsgi-, from mod_wsgi-express-3 >> LoadModule wsgi_module >> "/usr/lib64/python3.7/site-packages/mod_wsgi/server/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so >> <http://mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so/>" >> >> #this is the actual apache module location: >> #LoadModule wsgi_module "/etc/httpd/modules/mod_wsgi_python3.so" >> >> WSGIPythonHome "/usr" #pyhon3 is under /usr/lib/python3.7 etc. >> WSGIPythonPath >> "/usr/lib64/python3.7:/usr/lib64/python3.7/lib-dynload:/usr/lib64/python3.7/site-packages" >> >> <Directory "/opt/hawmusarchive/"> >> Require all granted >> </Directory> >> >> #---------------------------------------------------- >> #---------------------------------------------------- >> ## VIRTUAL HOST >> #---------------------------------------------------- >> #---------------------------------------------------- >> <VirtualHost *:80> >> ServerName hawmusarchive.128.171.51.150.nip.io >> <http://hawmusarchive.128.171.51.150.nip.io/> >> ServerAlias hawmusarchive.128.171.51.150.nip.io >> <http://hawmusarchive.128.171.51.150.nip.io/> >> DocumentRoot /var/www/html >> <Directory /opt/hawmusarchive> >> Options +Indexes +Includes +FollowSymLinks +MultiViews >> AllowOverride All >> Require all granted >> </Directory> >> #WSGIScriptAlias / "/var/www/html/hawmusarchive/hawmusarchive/wsgi.py" >> process-group=hawmusarchive >> WSGIScriptAlias / "/opt/hawmusarchive/hawmusarchive/wsgi.py" >> <Directory "/opt/hawmusarchive/hawmusarchive"> >> <Files wsgi.py> >> Require all granted >> </Files> >> </Directory> >> Alias /robots.txt /opt/hawmusarchive/static/robots.txt >> Alias /favicon.ico /opt/hawmusarchive/static/favicon.ico >> >> Alias /media/ /opt/hawmusarchive/media/ >> Alias /static/ /opt/hawmusarchive/static/ >> >> <Directory /opt/hawmusarchive/static> >> Require all granted >> </Directory> >> >> <Directory /opt/hawmusarchive/media> >> Require all granted >> </Directory> >> >> </VirtualHost> >> >> >> >> >> >> >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "modwsgi" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] >> <mailto:[email protected]>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/modwsgi/CALWZDaMkOBP0eVLhxq7_jZi%2BmLi9nQBQh_taofMzAE9x7A1YRQ%40mail.gmail.com >> >> <https://groups.google.com/d/msgid/modwsgi/CALWZDaMkOBP0eVLhxq7_jZi%2BmLi9nQBQh_taofMzAE9x7A1YRQ%40mail.gmail.com?utm_medium=email&utm_source=footer>. > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/7BF16480-8D58-4B6A-AE8E-D8F10668A4AF%40gmail.com.
