Skip to content

Commit 7c6afb1

Browse files
Merge branch 'release/4.5.18'
2 parents 0b5a1a7 + 9888f81 commit 7c6afb1

File tree

8 files changed

+117
-49
lines changed

8 files changed

+117
-49
lines changed

README.rst

Lines changed: 80 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,45 @@ The first way of installing mod_wsgi is the traditional way that has been
1212
used by many software packages. This is where it is installed as a module
1313
directly 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

2628
This later mechanism for installing mod_wsgi using Python ``pip`` is a much
2729
simpler 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
2931
Apache/mod_wsgi in a development environment without the need to perform
3032
any Apache configuration yourself.
3133

3234
The Apache module for mod_wsgi created when using the ``pip install``
3335
method 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

4655
System 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

91111
Installation into Apache
92112
------------------------
@@ -108,8 +128,8 @@ application.
108128
Installation 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
126146
to the location of the Apache ``apxs`` script for your Apache installation
127147
before 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+
129155
Note that nothing will be copied into your Apache installation at this
130156
point. As a result, you do not need to run this as the root user unless
131157
installing it into a site wide Python installation rather than a Python
132158
virtual environment. It is recommended you always use Python virtual
133159
environments and never install any Python package direct into the system
134160
Python 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
265291
SELinux or move the directory used with ``--server-root`` to an allowed
266292
location.
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+
268299
Using mod_wsgi-express with Django
269300
----------------------------------
270301

@@ -321,10 +352,14 @@ Connecting into Apache installation
321352

322353
If you want to use mod_wsgi in combination with your system Apache
323354
installation, 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

329364
The CMMI installation method also involves a bit more work as you need to
330365
separately 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
346381
module and tell mod_wsgi where the Python installation directory or virtual
347382
environment 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

358393
Note that because in this scenario the mod_wsgi module for Apache could be
359394
located in a Python virtual environment, if you destroy the Python virtual
360395
environment 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

365400
Instead of referencing the mod_wsgi module from the Python installation,
366401
you 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
373408
This is similar to above except that the mod_wsgi module was copied to the
374409
Apache modules directory first and the ``LoadModule`` directive references
375410
it 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.

docs/configuration-directives/WSGIRestrictEmbedded.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ is therefore enabled, any attempt to make a request against a WSGI
1313
application which hasn't been properly configured so as to be delegated to
1414
a daemon mode process will fail with a HTTP internal server error response.
1515

16-
This option does not exist on Windows, or Apache 1.3 or any other
17-
configuration where daemon mode is not available.
16+
For historical reasons and to maintain backward compatibility with old
17+
configurations this option is 'Off' by default. As daemon mode is the
18+
preferred deployment method, it is good practice to override the default
19+
and set this to 'On', ensuring you have set up and are always using daemon
20+
mode.
21+
22+
This option does not exist on Windows or any other configuration where
23+
daemon mode is not available.

docs/release-notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Release Notes
55
.. toctree::
66
:maxdepth: 2
77

8+
release-notes/version-4.5.18
89
release-notes/version-4.5.17
910
release-notes/version-4.5.16
1011
release-notes/version-4.5.15
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
==============
2+
Version 4.5.18
3+
==============
4+
5+
Version 4.5.18 of mod_wsgi can be obtained from:
6+
7+
https://codeload.github.com/GrahamDumpleton/mod_wsgi/tar.gz/4.5.18
8+
9+
Features Changed
10+
----------------
11+
12+
* When using ``--url-alias`` with ``mod_wsgi-express`` and the target of
13+
the URL doesn't exist, it will now be assumed that it will be a directory
14+
rather than a file, when finally created. This is to accomodate where
15+
may have used ``--setup-only`` option or ``setup-server`` command to
16+
pre-generate config files before the directory is created.

docs/user-guides/quick-configuration-guide.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ script files are loaded and/or reloaded. This information can be quite
312312
valuable in determining what problem may be occuring.
313313

314314
Note that where the LogLevel directive may have been defined both in and
315-
outside of a VirualHost directive, due to the VirtualHost declaring its
315+
outside of a VirtualHost directive, due to the VirtualHost declaring its
316316
own error logs, both instances of the LogLevel directive should be changed.
317317

318318
This is because although the virtual host may have its own error log, some

src/server/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ def generate_apache_config(options):
10111011
reverse=True):
10121012
path = os.path.abspath(target)
10131013

1014-
if os.path.isdir(path):
1014+
if os.path.isdir(path) or not os.path.exists(path):
10151015
if target.endswith('/') and path != '/':
10161016
directory = path + '/'
10171017
else:

src/server/wsgi_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626
#define MOD_WSGI_MAJORVERSION_NUMBER 4
2727
#define MOD_WSGI_MINORVERSION_NUMBER 5
28-
#define MOD_WSGI_MICROVERSION_NUMBER 17
29-
#define MOD_WSGI_VERSION_STRING "4.5.17"
28+
#define MOD_WSGI_MICROVERSION_NUMBER 18
29+
#define MOD_WSGI_VERSION_STRING "4.5.18"
3030

3131
/* ------------------------------------------------------------------------- */
3232

win32/README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
Running mod_wsgi on Windows
33
===========================
44

5+
These instructions should no longer be used. To install mod_wsgi on Windows
6+
run ``pip install mod_wsgi``. Once it has been successfully installed, run
7+
the command ``mod_wsgi-express module-config``. Copy the output of that
8+
command and add it to your Apache configuration to have it load mod_wsgi.
9+
You will still need to separately configure Apache/mod_wsgi for your
10+
specific WSGI application. See the mod_wsgi package page on the Python
11+
Package Index (PyPi) for more information.
12+
513
Overview
614
--------
715

0 commit comments

Comments
 (0)