Mod_python Windows Installation
Apache RequirementsApache 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 RequirementsAny 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 modwsgi will be greater./ configureThe 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”.
PrerequisitesIn the ideal case your Operating System provides a pre-packagedversion of modpython. If not, you will need to compile ityourself. This version of modpython requires:. Python 2 (2.6 and up) or Python 3 (3.3 and up). Apache 2.2 or later.
Apache 2.4 is highly recommended over 2.2.In order to compile modpython you will need to have the include filesfor both Apache and Python, as well as the Python library installed onyour system. If you installed Python and Apache from source, then youalready have everything needed. However, if you are using pre-packagedsoftware then you may need to install the “development” packageswhich contain the include files and libraries necessary to compilemodpython. Please check your OS documentation for specifics.
(Hint:look for packages named python-devel or python-dev and apache-devel orapache-dev or httpd-dev, etc.). $./configure -with-mutex-dir=/var/run/modpythonThe mutex directory can also be specified at run time usingmodpython.mutexdirectory.See.New in version 3.3.0.Sets the maximum number of mutex locks reserved by modpython.Note: mutex locks are used only by and(which maintains a Session implicitly).
If you’renot using modpython Sessions or PSP, then this setting should notmatter.The mutexes used for locking are a limited resource on somesystems. Increasing the maximum number of locks may increase performancewhen using session locking.
The default is 8. A reasonable number forhigher performance would be 32.Use with-max-locks option, e.g. $./configure -with-max-locks=32The number of locks can also be specified at run time usingmodpython.mutexlocks.See.New in version 3.2.0.Attempts to locate flex and determine its version.If flex cannot be found in your PATH configurewill fail. If the wrong version is found configure will generate a warning.You can generally ignore this warning unless you need to re-createsrc/pspparser.c.The parser used by psp (See ) is written in Cgenerated using flex. (This requires a reentrant versionof flex, 2.5.31 or later).If the first flex binary in the path is not suitable or not the one desiredyou can specify an alternative location with the option:with-flex:option, e.g.
AddHandler modpython.pyPythonHandler mptestPythonDebug On(Substitute /some/directory above for something applicable toyour system, usually your Apache ServerRoot)This configuration can also be specified in an.htaccessfile. Note that.htaccess configuration is typicallydisabled by default, to enable it in a directory specifyAllowOverride with at least FileInfo.This causes all requests for URLs ending in.py to be processedby modpython. Upon being handed a request, modpython looks forthe appropriate python handler to handle it. Here, there is asingle PythonHandler directive defining module mptest asthe python handler to use. We’ll see next how this python handleris defined.At this time, if you made changes to the main configuration file,you will need to restart Apache in order for the changes to takeeffect.Edit mptest.py file in the htdocs/test directory sothat is has the following lines (be careful when cutting andpasting from your browser, you may end up with incorrectindentation and a syntax error). From modpython import apache def handler ( req ): req.
Linguatec personal translator v14.0 professional *multilanguage* resume. Contenttype = 'text/plain' req. Write ( 'Hello World!' ) return apache. OK.Point your browser to the URL referring to the mptest.py;you should see 'Hello World!' If you didn’t - refer to thetroubleshooting section next.Note that according to the configuration written above, you canpoint your browser to any URL ending in.py in the testdirectory. Therefore pointing your browser to/test/foobar.py will be handled exactly the same way bymptest.py. This is because the code in the handlerfunction does not bother examining the URL and always acts the sameway no matter what the URL is.If everything worked well, move on to Chapter.
Mod_python Vs Mod_wsgi
SetHandler modpythonPythonHandler modpython.testhandlerNow point your browser to the /mpinfo URL(e.g. And note down the information given.This will help you reporting your problem to the modpython list.Ask on the.Please make sure to provide specifics such as:. modpython version. Your operating system type, name and version. Your Python version, and any unusual compilation options. Your Apache version. Relevant parts of the Apache config,.htaccess.
Relevant parts of the Python code.