This document describes the steps for installing mod_wsgi on a UNIX systemfrom the original source code.
The proper way to install modpython is simply to have an Apache 2.0.x server up and running, to have a working Python 2.4 setup, and to launch the installer. It should first set-up the python packages (you should have a few files under site-packages, most importantly apache.py and publisher.py). Previous message: modpython Windows Installation Next message: modpython Windows Installation Messages sorted by: Hi Faizan, Here is an answer I gave a few month ago about a similar problem. ' One of the possible cause of your problem is that Apache does find modpython.so but not one of the DLL it relies on.
Apache Requirements¶
Apache 2.0, 2.2 or 2.4 can be used.
For Apache 2.0, 2.2 and 2.4, the single threaded ‘prefork’ or multithreaded‘worker’ Apache MPMs can be used. For Apache 2.4 the ‘event’ MPM can alsobe used.
The version of Apache and its runtime libraries must have be compiled withsupport for threading.
On Linux systems, if Apache has been installed from a package repository,you must have installed the corresponding Apache “dev” package as well.
For most Linux distributions, the “dev” package for Apache 2.X is“apache2-dev” where the corresponding Apache package was “apache2”. Somesystems however distinguish the “dev” package based on which MPM is used byApache. As such, it may also be called “apache2-worker-dev” or“apache2-prefork-dev”. If using Apache 2.X, do not mix things up and install“apache-dev” by mistake, which is the “dev” package for Apache 1.3 calledjust “apache”.
Python Requirements¶
Any Python 2.X version from Python 2.6 onwards can be used. For Python 3.X,you will need Python 3.3 or later.
The version of Python being used must have been compiled with support forthreading.
On Linux systems, if Python has been installed from a package repository,you must have installed the corresponding Python “dev” package as well.
Python should preferably be available as a shared library. If this is notthe case then base runtime memory usage of mod_wsgi will be greater.
Unpacking The Source Code¶
Source code tar balls can be obtained from:
After having downloaded the tar ball for the version you want to use,unpack it with the command:
Replace ‘X.Y’ with the actual version number for that being used.
Configuring The Source Code¶
To setup the package ready for building run the “configure” script fromwithin the source code directory:
The configure script will attempt to identify the Apache installation touse by searching in various standard locations for the Apache build toolsincluded with your distribution called “apxs2” or “apxs”. If not found inany of these standard locations, your PATH will be searched.
Which Python installation to use will be determined by looking for the“python” executable in your PATH.
If these programs are not in a standard location, they cannot be found inyour PATH, or you wish to use alternate versions to those found, the
--with-apxs and --with-python options can be used in conjunction withthe “configure” script:
On some Linux distributions, such as SUSE and CentOS, it will be necessaryto use the
--with-apxs option and specify either “/usr/sbin/apxs2-worker”or “/usr/sbin/apxs2-prefork”. This is necessary as the Linux distribtionsallow installation of “dev” packages for both Apache MPM variants at thesame time, whereas other Linux distributions do not.
If you have multiple versions of Python installed and you are not usingthat which is the default, you may have to organise that the PATH inheritedby the Apache application when run will result in Apache finding thealternate version. Alternatively, the WSGIPythonHome directive shouldbe used to specify the exact location of the Python installationcorresponding to the version of Python compiled against. If this is notdone, the version of Python running within Apache may attempt to use thePython modules from the wrong version of Python.
Building The Source Code¶
Once the package has been configured, it can be built by running:
If the mod_wsgi source code does not build successfully, see:
If successful, the only product of the build process that needs to beinstalled is the Apache module itself. There are no separate Python codefiles as everything is done within C code compiled into the Apache module.
To install the Apache module into the standard location for Apache modulesas dictated by Apache for your installation, run:
Installation should be done as the ‘root’ user or ‘sudo’ command ifappropriate.
If you want to install the Apache module in a non standard locationdictated by how your operating system distribution structures theconfiguration files and modules for Apache, you will need to copy the filemanually into place.
If installing the Apache module by hand, the file is called ‘mod_wsgi.so’.The compiled Apache module can be found in the “.libs” subdirectory. Thename of the file should be kept the same when copied into its appropriatelocation.
Loading Module Into Apache¶
Once the Apache module has been installed into your Apache installation’smodule directory, it is still necessary to configure Apache to actuallyload the module.
Exactly how this is done and in which of the main Apache configurationfiles it should be placed, is dependent on which version of Apache you areusing and may also be influenced by how your operating system’s Apachedistribution has organised the Apache configuration files. You maytherefore need to check with any documentation for your operating system tosee in what way the procedure may need to be modified.
In the simplest case, all that is required is to add a line of the form:
into the main Apache “httpd.conf” configuration file at the same point thatother Apache modules are being loaded. The last option to the directiveshould either be an absolute path to where the mod_wsgi module file islocated, or a path expressed relative to the root of your Apacheinstallation. If you used “make” to install the package, see where itcopied the file to work out what to set this value to.
Restart Apache Web Server¶
Having adding the required directives you should perform a restart ofApache to check everything is okay. If you are using an unmodified Apachedistribution from the Apache Software Foundation, a restart is performedusing the ‘apachectl’ command:
If you see any sort of problem, or if you are upgrading from an olderversion of mod_wsgi, it is recommended you actually stop and the startApache instead:
Note that on many Linux distributions where Apache is prepackaged, theApache software has been modified and as a result the ‘apachectl’ commandmay not work properly or the command may not be present. On these systems,you will need to use whatever is the sanctioned method for restartingsystem services.
This may be via an ‘init.d’ script:
or via some special service maintenance script.
On Debian derived distributions, restarting Apache is usually done via the‘invoke-rc.d’ command:
On RedHat derived distributions, restarting Apache is usually done via the‘service’ command:
In nearly all cases the scripts used to restart Apache will need to be runas the ‘root’ user or via ‘sudo’.
In general, for any system where you are using a prepackaged version ofApache, it is wise to always check the documentation for that package orsystem to determine the correct way to restart the Apache service. This isbecause they often use a wrapper around ‘apachectl’, or replace it, with ascript which performs additional actions.
If all is okay, you should see a line of the form:
in the Apache error log file.
Cleaning Up After Build¶
To cleanup after installation, run:
If you need to build the module for a different version of Apache, youshould run:
and then rerun “configure” against the alternate version of Apache beforeattempting to run “make” again.
Release Date: Dec. 19, 2017
Python 3.6.4 was the fourth maintenance release of Python 3.6.
There are now newer security-fix releases of Python 3.6 that supersede 3.6.4 and Python 3.8 is now the latest feature release of Python 3. Get the latest releases of 3.6.x and 3.8.x here. Python 3.6.8 is planned to be the last bugfix releasefor 3.6.x. Following the release of 3.6.8, we plan to provide security fixes for Python 3.6 as needed through 2021, five years following its initial release.
Among the new major new features in Python 3.6 were:
Notes on this release
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |