Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 517
Robin De Schepper Avatar asked Jan 18 '20 14:01

Robin De Schepper


People also ask

Where does pip install mod_wsgi?

The Apache installation must be installed in C:\Apache24 directory. Run pip install mod_wsgi . The run mod_wsgi-express module-config and it will generate the required configuration to add into the Apache configuration file to load the mod_wsgi module.

What is mod_wsgi in Apache?

mod_wsgi is an Apache HTTP Server module by Graham Dumpleton that provides a WSGI compliant interface for hosting Python based web applications under Apache. As of version 4.5. 3, mod_wsgi supports Python 2 and 3 (starting from 2.6 and 3.2).


2 Answers

  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
  1. 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.

  1. Get module configuration:
mod_wsgi-express module-config
  1. 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.

like image 82
Robin De Schepper Avatar answered Sep 22 '22 19:09

Robin De Schepper


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.

like image 30
vodkaJedi Avatar answered Sep 18 '22 19:09

vodkaJedi