Fatal Python error: Py_Initialize: Unable to get the locale encoding

#1
Has anyone successfully configured python wsgi?

Trying to make Falcon work with openlitespeed but I can even make Flask work following instruction here:
https://openlitespeed.org/kb/python-wsgi-applications/

I keep stumbling with following error in stderr.log
Code:
2020-05-09 08:59:17.306 [STDERR] Cgid: Child process with pid: 26460 was killed by signal: 6, core dump: 128
2020-05-09 08:59:27.632 [STDERR] Fatal Python error: Py_Initialize: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Here's my setup:
vhost name: WING
vhost root: /srv/vhosts/$VH_NAME/
config file: $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
Document Root: $VH_ROOT/cgi

Context = App Server:
URI = /
Location: $DOC_ROOT/flask
Binary Path: /usr/local/lsws/fcgi-bin/lswsgi
App Type: WSGI
Startup File: wsgi.py
Environment:
WSGIPythonHome=/srv/vhosts/WING/cgi/flask/venv/
PYTHONHOME=/srv/vhosts/WING/cgi/flask/venv/
LS_PYTHONBIN=/srv/vhosts/WING/cgi/flask/venv/bin/python
Bash:
(venv) [root@webserver-1 cgi]# pwd
/srv/vhosts/WING/cgi
(venv) [root@webserver-1 cgi]# ls -laR flask/
flask/:
total 4
drwxrwxrwx. 3 nobody  nobody  48 May  9 07:57 .
drwxr-x---. 5 user_01 nobody  43 May  9 07:47 ..
lrwxrwxrwx. 1 root    root     7 May  9 07:57 _wsgi.py -> wsgi.py
drwxrwxrwx. 2 nobody  nobody  25 May  9 07:47 app
-rwxrwxrwx. 1 nobody  nobody 121 May  9 07:49 wsgi.py

flask/app:
total 4
drwxrwxrwx. 2 nobody nobody  25 May  9 07:47 .
drwxrwxrwx. 3 nobody nobody  48 May  9 07:57 ..
-rwxrwxrwx. 1 nobody nobody 104 May  9 07:47 __init__.py
What tried:
- use third party virtualenv package
- change files permission to 777
- in the server log, it looked like openlitespeed was trying to look for _wsgi.py instead of wsgi.py so i created symlink

Attached is server.log with debug trace (level low).
 

Attachments

Top