How to install mod_wsgi into Apache on Windows?
Asked Answered
C

3

18

Other similar answers are out of date or focus on a particular error and not the whole process.

What is the full installation process of mod_wsgi into an Apache installation on Windows 10?

Claudicant answered 18/1, 2020 at 14:11 Comment(0)
C
28
  1. Install Microsoft Visual C++ Build Tools: https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. Point MOD_WSGI_APACHE_ROOTDIR to your installation (default is C:/Apache24). Use forward slashes:

    set MOD_WSGI_APACHE_ROOTDIR=C:/Users/me/apache
    

    For PowerShell this would be (with backward slashes):

    $env:MOD_WSGI_APACHE_ROOTDIR="C:\Users\me\apache"
    
  3. Install mod-wsgi package:

    pip install mod-wsgi
    

    Note: Make sure that the python version you're using has the same architecture (32/64 bit) as your Apache version.

  4. Get module configuration:

    mod_wsgi-express module-config
    
  5. Copy the output of the previous command into your Apache's httpd.conf.

When you restart Apache, mod_wsgi will be loaded. Check out the quickstart Hello World example to test your mod_wsgi installation.

Claudicant answered 18/1, 2020 at 14:11 Comment(2)
When I was using Powershell with a virtual environment activated, the command in step 2 did not work for me. It generated no error but the environment variable did not get set either. However I got the variable assignment to work using this command instead: $env:MOD_WSGI_APACHE_ROOTDIR="C:\Users\me\apache". (Note with this command it needed backward slashes.) With that substitution for Step 2, the mod-wsgi install in Step 3 was successful.Leadsman
I'll add the PowerShel variantClaudicant
U
2

Also be sure to check that your Apache and Python got same architecture (32/64bit) and MS Build Tools is compatible with Python version.

Been trying to compile mod_wsgi using different combinations of MS Build Tools for a few hours before I noticed that Python 3.8 is 32bit and Apache Lounge 2.4 is 64bit.

Upi answered 5/9, 2020 at 0:14 Comment(0)
P
0

I would just like to add to @Robin (Robin's answer). This solution is as written by Graham Dumpleton's answer in github issues.

Try and delete mod-wsgi first

pip uninstall mod_wsgi

it will spit out the dir of all the installed mod-wsgi and mod-wsgi-express

cd " to the dir mod-express is installed"

and then run

mod_wsgi-express module-config

you will get the config you wanted

Pettiford answered 30/12, 2022 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.