Hi Sm0ke, Thank you for this great article. It is very helpful and well written.
I noticed what I believe is one small typo. Where it says "app/init.py file contents" I believe it should say "app/init.py file contents", and that is probably a Markdown issue.
Were you able to resolve @williamium3000
's issues regarding setting the python interpreter? I'm trying to get this to work with pyenv (pyenv install 3.9.5), but can't get mod_wsgi to see my locally installed interpreter in my venv, even if I put it in the she-bang
#!/data/apps/hitme/.venv/bin/python
import os
import sys
def application(environ, start_response):
status = '200 OK'
output = bytes(getEnv(), 'utf-8')
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
def getEnv():
keys = list(os.environ.keys())
keys.sort()
o = ''
o += "OS Environment\n"
o += 'Python Version: %s\n' % sys.version
o += 'Python prefix: %s\n' % sys.prefix
for k in keys:
v = os.environ[k]
o += (" %s: %s\n" % (k, v))
return o
Reports:
OS Environment
Python Version: 3.6.8 (default, Mar 18 2021, 08:58:41)
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
Python prefix: /apps/mod_wsgi/.venv
INVOCATION_ID: 8c7e2ab82ab7415ca0e1e2c1fddde05a
JOURNAL_STREAM: 9:1072847
LANG: C
NOTIFY_SOCKET: /run/systemd/notify
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
3.6.8 is the OS's python version. Thanks for your help
Hi Sm0ke, Thank you for this great article. It is very helpful and well written.
I noticed what I believe is one small typo. Where it says "app/init.py file contents" I believe it should say "app/init.py file contents", and that is probably a Markdown issue.
Were you able to resolve @williamium3000 's issues regarding setting the python interpreter? I'm trying to get this to work with pyenv (pyenv install 3.9.5), but can't get mod_wsgi to see my locally installed interpreter in my venv, even if I put it in the she-bang
Reports:
3.6.8 is the OS's python version. Thanks for your help
Hello @dlink ,
Indeed the
app/\_\_init\_\_.py
cannot be formatted being styled automatically by the Markdown parser.Regarding the Python version, try to force the PATH update in wsgi.py as below
P.S. adapt the paths to be resolved properly.
Let me know the results.