After spending several hours attempting to get this working, I have come to the conclusion that there appears to be a bug with the wsgi-lsapi applet. I'll begin by showing you what the stderr.log produces upon every request:
The error,
, does not occur under any other context. When I run my project manually with python or use Apache and mod_wsgi, everything is fine. I have ensured that wsgi-lsapi was compiled for the correct version of python that I'm using, as I did like so after extracting the source:
My context within my virtual host looks as follows:
This is all following the official documentation practically verbatim found here https://docs.openlitespeed.org/config/appserver/python/. I experimented to see if it was possible to have uWSGI as an external applet to serve my project through OpenLiteSpeed, however this appears to be unsupported to the best of my knowledge. I would prefer to use wsgi-lsapi if at all possible. I have not experimented with python versions less than 3.12, although if it was working for earlier versions, I would assume it is something particular with newer python builds.
Python:
Traceback (most recent call last):
File "/var/www/example.com/myapp/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/core/wsgi.py", line 1, in <module>
import django
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/utils/version.py", line 4, in <module>
import subprocess
File "/usr/lib/python3.12/subprocess.py", line 46, in <module>
import locale
File "/var/www/example.com/myapp/locale.py", line 1, in <module>
from django.utils.translation import gettext_lazy, gettext_noop, ngettext_lazy
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/utils/translation/__init__.py", line 8, in <module>
from django.utils.autoreload import autoreload_started, file_changed
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/utils/autoreload.py", line 19, in <module>
from django.core.signals import request_finished
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/core/signals.py", line 1, in <module>
from django.dispatch import Signal
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/dispatch/__init__.py", line 9, in <module>
from django.dispatch.dispatcher import Signal, receiver # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/www/example.com/.venv/lib/python3.12/site-packages/django/dispatch/dispatcher.py", line 1, in <module>
import asyncio
File "/usr/lib/python3.12/asyncio/__init__.py", line 8, in <module>
from .base_events import *
File "/usr/lib/python3.12/asyncio/base_events.py", line 41, in <module>
from . import events
File "/usr/lib/python3.12/asyncio/events.py", line 211, in <module>
class AbstractEventLoop:
File "/usr/lib/python3.12/asyncio/events.py", line 519, in AbstractEventLoop
stdin=subprocess.PIPE,
^^^^^^^^^^^^^^^
AttributeError: partially initialized module 'subprocess' has no attribute 'PIPE' (most likely due to a circular import)
[UID:65534][246060] packetLen < 0
The error,
Code:
AttributeError: partially initialized module 'subprocess' has no attribute 'PIPE' (most likely due to a circular import)
Bash:
python3.12 ./configure.py
make
cp lswsgi /usr/local/lsws/fcgi-bin/
My context within my virtual host looks as follows:
Code:
Type = App Server
URI = /
Location = /var/www/example.com
Binary Path = /usr/local/lsws/fcgi-bin/lswsgi
Application Type = WSGI
Startup File = myapp/wsgi.py
Environment = PYTHONPATH=/var/www/example.com:/var/www/example.com/myapp:/var/www/example.com/.venv/lib/python3.12
Environment = LS_PYTHONBIN=/var/www/example.com/.venv/bin/python3.12
This is all following the official documentation practically verbatim found here https://docs.openlitespeed.org/config/appserver/python/. I experimented to see if it was possible to have uWSGI as an external applet to serve my project through OpenLiteSpeed, however this appears to be unsupported to the best of my knowledge. I would prefer to use wsgi-lsapi if at all possible. I have not experimented with python versions less than 3.12, although if it was working for earlier versions, I would assume it is something particular with newer python builds.