@@ -12,36 +12,45 @@ The first way of installing mod_wsgi is the traditional way that has been
1212used by many software packages. This is where it is installed as a module
1313directly into your Apache installation using the commands ``configure ``,
1414``make `` and ``make install ``, a method sometimes referred to by the
15- acyronym CMMI.
15+ acyronym CMMI. This method works with most UNIX type systems. It cannot
16+ be used on Windows.
1617
17- The second and newest way of installing mod_wsgi is to install it as a
18- Python package into your Python installation using the Python ``pip
19- install `` command .
18+ The second way of installing mod_wsgi is to install it as a Python package
19+ into your Python installation using the Python ``pip install `` command.
20+ This can be used on all platforms, including Windows .
2021
21- This newer way of installing mod_wsgi will compile not only the Apache
22- module for mod_wsgi, but will also install a Python module and admin script
23- for starting up a standalone instance of Apache directly from the command
24- line with an auto generated configuration.
22+ This second way of installing mod_wsgi will compile not only the Apache
23+ module for mod_wsgi, but will also install a Python module and admin
24+ script, which on UNIX type systems can be used to start up a standalone
25+ instance of Apache directly from the command line with an auto generated
26+ configuration.
2527
2628This later mechanism for installing mod_wsgi using Python ``pip `` is a much
2729simpler way of getting starting with hosting your Python web application.
28- In particular, the new installation method makes it very easy to use
30+ In particular, this installation method makes it very easy to use
2931Apache/mod_wsgi in a development environment without the need to perform
3032any Apache configuration yourself.
3133
3234The Apache module for mod_wsgi created when using the ``pip install ``
3335method can still be used with the main Apache installation, via manual
34- configuration if necessary.
35-
36- On some platforms, this latter method is actually the only option supported
37- when using the operating system supplied Apache installation. For example,
38- in MacOS X Sierra, Apple has completely broken the ability to install third
39- party Apache modules using the ``apxs `` tool normally used for this task.
40- History suggests that Apple will never fix the problem as they have broken
41- things in the past in other ways and workarounds were required as they
42- never fixed those problems either. This time there is no easy workaround as
43- they no longer supply certain tools which are required to perform the
44- installation.
36+ configuration if necessary. As detailed later in these instructions, the
37+ admin script installed when you use ``pip install `` can be used to generate
38+ the configuration to manually add to the Apache configuration to load
39+ mod_wsgi.
40+
41+ Note that although MacOS X is a UNIX type system, the ``pip install ``
42+ method is the only supported way for installing mod_wsgi.
43+
44+ Since MacOS X Sierra, Apple has completely broken the ability to install
45+ third party Apache modules using the ``apxs `` tool normally used for this
46+ task. History suggests that Apple will never fix the problem as they have
47+ broken things in the past in other ways and workarounds were required as
48+ they never fixed those problems either. This time there is no easy
49+ workaround as they no longer supply certain tools which are required to
50+ perform the installation.
51+
52+ The ``pip install `` method along with manual configuration of Apache
53+ is also the method you need to use on Windows.
4554
4655System Requirements
4756-------------------
@@ -85,8 +94,19 @@ RHEL, CentOS or Fedora, you would need:
8594* httpd24
8695* httpd24-httpd-devel
8796
88- If you are running MacOS X, you will need to have the Xcode command line
89- tools installed. These can be installed by running ``xcode-select --install ``.
97+ If you are running MacOS X, Apache is supplied with the operating system.
98+ If running a recent MacOS X version, you will though need to have the Xcode
99+ command line tools installed as well as the Xcode application. The command
100+ line tools can be installed by running ``xcode-select --install ``. The
101+ Xcode application can be installed from the MacOS X App Store. If you are
102+ using older MacOS X versions, you may be able to get away with having just
103+ the command line tools.
104+
105+ If you are running Windows, it is recommended you use the Apache
106+ distribution from Apache Lounge (www.apachelounge.com). Other Apache
107+ distributions for Windows aren't always complete and are missing the files
108+ needed to compile additional Apache modules. By default, it is expected
109+ that Apache is installed in the directory ``C:/Apache24 `` on Windows.
90110
91111Installation into Apache
92112------------------------
@@ -108,8 +128,8 @@ application.
108128Installation into Python
109129------------------------
110130
111- To install the mod_wsgi directly into your Python installation, from within
112- the source directory of the mod_wsgi package you can run::
131+ To install mod_wsgi directly into your Python installation, from within the
132+ source directory of the mod_wsgi package you can run::
113133
114134 python setup.py install
115135
@@ -126,15 +146,21 @@ standard location, you can set and export the ``APXS`` environment variable
126146to the location of the Apache ``apxs `` script for your Apache installation
127147before performing the installation.
128148
149+ If you are on Windows and your Apache distribution is not installed into
150+ the directory ``C:/Apache24 ``, first set the environment variable
151+ ``MOD_WSGI_APACHE_ROOTDIR `` to the directory containing the Apache
152+ distribution. Ensure you use forward slashes in the directory path. The
153+ directory path should not include path components with spaces in the name.
154+
129155Note that nothing will be copied into your Apache installation at this
130156point. As a result, you do not need to run this as the root user unless
131157installing it into a site wide Python installation rather than a Python
132158virtual environment. It is recommended you always use Python virtual
133159environments and never install any Python package direct into the system
134160Python installation.
135161
136- To verify that the installation was successful, run the `` mod_wsgi-express ``
137- script with the ``start-server `` command::
162+ On a UNIX type system, to verify that the installation was successful, run
163+ the `` mod_wsgi-express `` script with the ``start-server `` command::
138164
139165 mod_wsgi-express start-server
140166
@@ -265,6 +291,11 @@ allowed to access, don't match where the directory specified using the
265291SELinux or move the directory used with ``--server-root `` to an allowed
266292location.
267293
294+ In all cases, any error messages will be logged to a file under the server
295+ root directory. If you are using ``mod_wsgi-express `` with a process
296+ supervisor, or in a container, where log messages are expected to be sent
297+ to the terminal, you can use the ``--log-to-terminal `` option.
298+
268299Using mod_wsgi-express with Django
269300----------------------------------
270301
@@ -321,10 +352,14 @@ Connecting into Apache installation
321352
322353If you want to use mod_wsgi in combination with your system Apache
323354installation, the CMMI method for installing mod_wsgi would normally be
324- used. If you are on MacOS X Sierra that is no longer possible. Even prior
325- to MacOS X Sierra, the System Integrity Protection (SIP) system of MacOS X,
326- prevented installing the mod_wsgi module into the Apache modules
327- directory.
355+ used.
356+
357+ If you are on MacOS X Sierra that is no longer possible. Even prior to
358+ MacOS X Sierra, the System Integrity Protection (SIP) system of MacOS X,
359+ prevented installing the mod_wsgi module into the Apache modules directory.
360+
361+ If you are using Windows, the CMMI method was never supported as Windows
362+ doesn't supply the required tools tools to make it work.
328363
329364The CMMI installation method also involves a bit more work as you need to
330365separately download the mod_wsgi source code, run the ``configure `` tool
@@ -346,21 +381,21 @@ These are the directives needed to configure Apache to load the mod_wsgi
346381module and tell mod_wsgi where the Python installation directory or virtual
347382environment was located.
348383
349- This would be placed in the Apache ``httpd.conf `` file, or if the Linux
350- distribution separates out module configuration into a `` mods-available ``
351- directory, in the ``wsgi.load `` file within the `` mods-available ``
352- directory. In the latter case where a ``mods-available `` directory is used,
353- the module would then be enabled by running `` a2enmod wsgi `` as `` root ``.
354- If necessary Apache can then be restarted to verify the module is loading
355- correctly. You can then configure Apache as necessary for your specific
356- WSGI application.
384+ This would be placed in the Apache ``httpd.conf `` file, or if using a Linux
385+ distribution which separates out module configuration into a
386+ `` mods-available `` directory, in the ``wsgi.load `` file within the
387+ `` mods-available `` directory. In the latter case where a ``mods-available ``
388+ directory is used, the module would then be enabled by running
389+ `` a2enmod wsgi `` as `` root ``. If necessary Apache can then be restarted to
390+ verify the module is loading correctly. You can then configure Apache as
391+ necessary for your specific WSGI application.
357392
358393Note that because in this scenario the mod_wsgi module for Apache could be
359394located in a Python virtual environment, if you destroy the Python virtual
360395environment the module will also be deleted. In that case you would need to
361- ensure you recreated the Python virtual environment and reinstalled the
362- mod_wsgi package using ``pip ``, or take out the mod_wsgi configuration from
363- Apache before restarting Apache or it will fail to startup.
396+ ensure you recreate the Python virtual environment and reinstall the
397+ mod_wsgi package using ``pip ``, or, take out the mod_wsgi configuration
398+ from Apache before restarting Apache, else it will fail to startup.
364399
365400Instead of referencing the mod_wsgi module from the Python installation,
366401you can instead copy the mod_wsgi module into the Apache installation. To
@@ -373,5 +408,7 @@ do that, run the ``mod_wsgi-express install-module`` command, running it as
373408This is similar to above except that the mod_wsgi module was copied to the
374409Apache modules directory first and the ``LoadModule `` directive references
375410it from that location. You should take these lines and configure Apache in
376- the same way as described above. Do note that copying the module like this
377- will not work on recent versions of MacOS X due to the SIP feature of MacOS X.
411+ the same way as described above.
412+
413+ Do note that copying the module like this will not work on recent versions
414+ of MacOS X due to the SIP feature of MacOS X.
0 commit comments