pythonwindowsapachemod-wsgiwsgi

How to install mod_wsgi into Apache on Windows?


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?


Solution

    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.