How to install PyWrapper

This is just a short document until the full installation guide with sreenshots is available. For help on upgrading from version 3.0 please see this thread.

There are 2 ways in which PyWrapper can be run: Behind a webserver like Apache, lighttpd or IIS using FastCGI or using the build-in CherryPy server. This documentation will first guide you through the CherryPy setup which is needed in any case and finally show you how to hook up the application with a webserver through FastCGI.

Standalone Installation

PyWrapper needs Python to run. You have the choice of using a shared, maybe already existing, python installation or use the pywrapper installer to create an independent PyWrapper installation with a local Python copy. We recommend to use the installer as it is much easier.

Any way you do it, first you gotta download the latest PyWrapper distribution from the Downloads section and eventually uncompress it in the folder where you want it to live, we will call it /pywrapper.

For the time being a subversion client is also needed it to run the installer.

A) Install locally using install.sh

foo$ svn export svn://svn.pywrapper.org:80/pywrapper/trunk
foo$ cd trunk/tools
foo$ /bin/sh install.sh

On some systems like debian the installer has known problem. Please refer to the InstallerTroubleshooting guide first to see if your OS is known to have problems and to find some workarounds.

B) Install Into System

0. First of all be sure that you have Python 2.4 or above installed on the machine. PyWrapper will not work with python2.3 or previous versions. You can test this by starting python at the terminal, it will tell you the exact version at startup.

There are several libraries necessary to run PyWrapper and its ConfigTool. All these libraries are normally installed in the same way. In windows just use the installer, in Unixes download the library in a temporary folder, uncompress it, and use:

$python setup.py install

1. Install PyXML

2. Install mxDateTime

3. Install lxml for libxml2

4. Install pyPgSQL if you plan to use PostgreSQL or MySQLdb if you want to use MySQL.

Now you are done with the libraries.

Finally you should run the tools/adapt_installation.py script that:

  • fixes permissions for the pywrapper files
  • updates the shebang line in python shell scripts to use the python interpreter that is being used to run the adapt_installation.py script

This script is called automatically when using the installer.sh script. Just make sure you use the right python interpreter (>2.3) to run the script. Otherwise the script will complain!

foo$ cd tools
foo$ python adapt_installation.py

You should get a lot of messages about files being adapted. and voila, thats it!

Start Standalone Server

To start the server go to /pywrapper/webapp/ and run ./start_server.py. By default PyWrapper server will run in port 8080, if you have a conflict in that port or want to change it you can supply the start script with a different port, e.g 8088 as shown here:

foo$ cd webapp/
foo$ ./start_server.py 8088

Configure PyWrapper v3.1.0dev CherryPy server using /somewhere/pywrapper/config/webapp.cfg
  mounting PyWrapper webapps to /pywrapper
  run server on port 8088
  http://localhost:8088/pywrapper
  start engine...

If you want to keep the server running in the background you can do something like:

foo$ ./start_server.py 8088 &
foo$ logout

You can now visit http://localhost:8088/pywrapper and use the PyWrapper web interface. To change the mounting point /pywrapper of the webapplication, you can modify this in the applications configuration file /pywrapper/config/config.ini. Modify the following line to whatever you prefer instead of pywrapper:

webroot  =  /pywrapper

Behind a webserver via FastCGI

First of all make sure you have a working standalone installation! Follow the guide above until you have pywrapper running.

Next you will need the fastcgi libraries:

Apache

You will need the FastCGI module for Apache, aka mod_fastcgi. It works with Apache 1.3 or Apache 2.

install mod_fastcgi on Linux

We first need to download the source code

You will want, at the time of this writing, mod_fastcgi-2.4.2.tar.gz. Extract the files and inside the mod_fastcgi directory, execute the following two lines as per the INSTALL file:

foo$ apxs -o mod_fastcgi.so -c *.c

This compiles the module. Now we need to install it. The installation procedure via apxs is smart enough to modify our Apache's httpd.conf on our behalf:

foo$ apxs -i -a -n fastcgi mod_fastcgi.so 

You can go ahead and verify that by finding the LoadModule? and AddModule? lines in /etc/httpd/httpd.conf that refer to mod_fastcgi.so.

install mod_fastcgi on Windows

Retrieve the latest mod_fastcgi DLL binary from http://fastcgi.com/dist/ To install it into your apache installation:

1. Copy the mod_fastcgi.dll to the Apache modules directory (e.g. C:\Apache\modules)

2. Edit the httpd configurion file (e.g. C:\Apache\conf\httpd.conf) and add a line like:

LoadModule fastcgi_module modules/mod_fastcgi.dll

Note that if there's a ClearModuleList? directive after new entry, you'll have to either move the LoadModule? after the ClearModuleList? or add (have a look at how the other modules are handled):

AddModule mod_fastcgi.c

Configure httpd.conf

Finally you need to configure Apache through its httpd.conf file. There is an example of a configuration given in the pywrapper installation at examples/apache/httpd-pywrapper-mod_fastcgi.conf. Copy this into your httpd.conf and modify it to reflect your installation paths.

lighttpd

will come soon. Helping Links:

IIS

will come soon. Helping Links: