mod_wsgi is configured with python2 on centOS when python3 is enabled

Bug #1872930 reported by lina He
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
devstack
Won't Fix
Low
Unassigned

Bug Description

I was configuring the stable/train horizon on CentOS using devstack and set USE_PYTHON3=True.

I got below error in /var/log/httpd/horizon_error.log.

2020-04-14 06:52:32.116948 mod_wsgi (pid=22756): Target WSGI script '/opt/stack/horizon/openstack_dashboard/wsgi.py' cannot be loaded as Python module.
2020-04-14 06:52:32.117028 mod_wsgi (pid=22756): Exception occurred processing WSGI script '/opt/stack/horizon/openstack_dashboard/wsgi.py'.
2020-04-14 06:52:32.117059 Traceback (most recent call last):
2020-04-14 06:52:32.117097 File "/opt/stack/horizon/openstack_dashboard/wsgi.py", line 21, in <module>
2020-04-14 06:52:32.117188 from django.core.wsgi import get_wsgi_application
2020-04-14 06:52:32.117216 ImportError: No module named django.core.wsgi

The django module is installed in python3 lib. But the mod_wsgi is configured with python2 based on the /var/log/httpd/error_log.

[Tue Apr 14 08:17:23.504300 2020] [mpm_worker:notice] [pid 7881:tid 140070784944256] AH00292: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_wsgi/3.4 Python/2.7.5 configured -- resuming normal operations
[Tue Apr 14 08:17:23.504338 2020] [core:notice] [pid 7881:tid 140070784944256] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

I checked the devstack/lib/apache code, the mod_wsgi is installed for fedora without python3 considering. I think it should check python3 and install corresponding mod_wsgi for it on fedora devstack same as the work for ubuntu.

function install_apache_wsgi {
    # Apache installation, because we mark it NOPRIME
    if is_ubuntu; then
        # Install apache2, which is NOPRIME'd
        install_package apache2
        if python3_enabled; then
            if is_package_installed libapache2-mod-wsgi; then
                uninstall_package libapache2-mod-wsgi
            fi
            install_package libapache2-mod-wsgi-py3
        else
            install_package libapache2-mod-wsgi
        fi
    elif is_fedora; then
        sudo rm -f /etc/httpd/conf.d/000-*
        install_package httpd mod_wsgi
        # For consistency with Ubuntu, switch to the worker mpm, as
        # the default is event
        sudo sed -i '/mod_mpm_prefork.so/s/^/#/g' /etc/httpd/conf.modules.d/00-mpm.conf
        sudo sed -i '/mod_mpm_event.so/s/^/#/g' /etc/httpd/conf.modules.d/00-mpm.conf
        sudo sed -i '/mod_mpm_worker.so/s/^#//g' /etc/httpd/conf.modules.d/00-mpm.conf

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Centos 7 is no longer supported on master/ussuri. If you can provide a patch for the train stable branch that fixed this, we can review it, but otherwise this will likely stay unresolved.

Changed in devstack:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

Assuming that this is no longer relevant.

Changed in devstack:
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.