Hi, I looked at previous messages and others on StackOverflow but none seem
to solve my issue.
I have an app I wrote working perfectly fine under Python 3.11 with
mod_wsgi and Apache 2.
I did a bunch of development on the app (upgraded django, new features),
and set up a new checkout of that on my server, with its own virtual
environment (using venv). It uses effectively the same config (different
subdomain) in Apache2 as the original older copy, but the new one fails
with an import error while the old one is still chugging along.
I double checked the instructions at
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/modwsgi/
I've also re-verified the mod_wsgi I installed (via pip) matches the Python
version I'm using (both are Python 3.11).
I also tried:
- Removing the python-path argument
- The mod_wsgi docs suggest I don't need that if I specify
python-home?
- Setting WSGIApplicationGroup to %{GLOBAL}
Unfortunately the error didn't change at all after trying those.
I've attached the relevant apache2 config section which includes all the
mod_wsgi-setup (the rest is just redirects, ssl stuff, aliases, etc.)
I also attached the error from the log. It looks like it's trying to use
the system Python instead of the one that exists in my .env (virtual
environment) directory.
I'm banging my head as to why this worked before but not now so any help is
much appreciated. Thank you! 🙂
Other details:
- wsgi.prod.py is the default wsgi.py, just modified to load
settings.prod.py
- The server is Devuan Daedalus
--
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/1856a102-140f-4174-a326-73d170d719bdn%40googlegroups.com.
[Sun May 12 20:22:58.097666 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] mod_wsgi (pid=4990): Failed to exec Python script
file '/home/asmcbain/enfilade/atcid/wsgi.py'.
[Sun May 12 20:22:58.097822 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] mod_wsgi (pid=4990): Exception occurred processing
WSGI script '/home/asmcbain/enfilade/atcid/wsgi.py'.
[Sun May 12 20:22:58.120689 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] Traceback (most recent call last):
[Sun May 12 20:22:58.132809 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] File "/home/asmcbain/enfilade/atcid/wsgi.py", line
12, in <module>
[Sun May 12 20:22:58.132874 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] from django.core.wsgi import get_wsgi_application
[Sun May 12 20:22:58.132911 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] File
"/home/asmcbain/enfilade/.env/lib/python3.11/site-packages/django/__init__.py",
line 1, in <module>
[Sun May 12 20:22:58.132926 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] from django.utils.version import get_version
[Sun May 12 20:22:58.132954 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] File
"/home/asmcbain/enfilade/.env/lib/python3.11/site-packages/django/utils/version.py",
line 1, in <module>
[Sun May 12 20:22:58.132969 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] import datetime
[Sun May 12 20:22:58.133000 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] File "/usr/lib/python3.11/datetime.py", line 12,
in <module>
[Sun May 12 20:22:58.133020 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] import math as _math
[Sun May 12 20:22:58.133072 2024] [wsgi:error] [pid 4990:tid 140242101196480]
[remote 192.168.1.1:20023] ModuleNotFoundError: No module named 'math'
Alias /favicon.ico /home/asmcbain/enfilade/static/favicon.ico
Alias /media/ /home/asmcbain/enfilade/media/
Alias /static/ /home/asmcbain/enfilade/static/
WSGIDaemonProcess enfilade.asmcbain.net \
user=asmcbain group=asmcbain \
display-name='%{GROUP}' \
lang='en_US.UTF-8' \
locale='en_US.UTF-8' \
threads=5 \
queue-timeout=45 \
socket-timeout=60 \
connect-timeout=15 \
request-timeout=60 \
inactivity-timeout=0 \
startup-timeout=15 \
deadlock-timeout=60 \
graceful-timeout=15 \
eviction-timeout=0 \
restart-interval=0 \
shutdown-timeout=5 \
maximum-requests=0 \
python-home=/home/asmcbain/enfilade/.env \
python-path=/home/asmcbain/enfilade
WSGIProcessGroup enfilade.asmcbain.net
WSGIApplicationGroup %{SERVER}
WSGIScriptAlias / /home/asmcbain/enfilade/atcid/wsgi.py
<Directory /home/asmcbain/enfilade/static>
Require all granted
</Directory>
<Directory /home/asmcbain/enfilade/media>
Require all granted
</Directory>
<Directory /home/asmcbain/enfilade>
<Files wsgi.prod.py>
Require all granted
</Files>
</Directory>