简体   繁体   中英

Check Python Version Used in Mod_WSGI

I can't find out which python environment is being used or install location is being used by mod_wsgi in Apache. In my apache config I didn't gave any specific venv config.

        ServerName 
        ServerAlias 
        DocumentRoot /home/Downloads

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        Alias /static /home/Downloads/static
        <Directory /home/Downloads/static>
                Require all granted
        </Directory>

        <Directory /home/Downloads/samples>
                Require all granted
        </Directory>

        <Directory /home/Downloads>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        #WSGIDaemonProcess group python-path=/home/Downloads python-home=/home/envlin
        WSGIProcessGroup group
        WSGIScriptAlias / /home/Downloads/wsgi.py

I removed the critical info and replaced with random info.

Here's my apache restart log

Apache Logs

Apache/2.4.46 (Ubuntu) OpenSSL/1.1.1j mod_wsgi/4.7.1 Python/3.9 configured -- resuming normal operations

Question

Is there any way to get which python version and install location is being used by mod_wsgi.

**Python Path's ** If I fetch python path's normally here's the result.

sys.path = [
    '/root',
    '/usr/lib/python39.zip',
    '/usr/lib/python3.9',
    '/usr/lib/python3.9/lib-dynload',
    '/usr/local/lib/python3.9/dist-packages',
    '/usr/lib/python3/dist-packages',
    '/usr/lib/python3.9/dist-packages',
]

I didn't found the way directly to get mod_wsgi version, however I went in root directory as root user and ran a find command.

/home//Downloads/env/lib/python3.9/site-packages/allauth
/home//gmcwebenvlin/lib/python3.9/site-packages/allauth
/home//.local/lib/python3.9/site-packages/allauth

And tried changing variable in urls.py in all packages and worked in one.

It turn out even when we specify different config file for SSL version of website in Apache, Python home was picked up from the non-SSL version config still.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM