All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
mod-python: Turbulence python language support


Turbulence's mod-python is a module extension that allows writing server side BEEP enabled python applications to handle/implement profiles. It allows writing dynamic applications that loads at run time, saving the compile-install cycle required by usual C modules.

Global mod-python python.conf location

Assuming you have a python app that works with Turbulence mod-python, you can configure it under the global python.conf file which is usually found at:


If you don't find the file, try running the following to find base directory where to find config files:

>> turbulence --conf-location

Site mod-python python.conf location

You can also place a python.conf file at the profile path working dir (work-dir attribute). This method is recommend in the case more application separation is needed.

Assuming you have the following profile path declaration:

<path-def server-name="core-admin"
src=".*" path-name="core-admin"
reuse="yes" run-as-user="core-admin" run-as-group="core-admin"
work-dir="/home/acinom/programas/core-admin/server-component" >
<!-- more declarations -->

Then you can place a python.conf file with your python app initializations at:


Configuring mod-python

No matter where is located your python.conf, inside that file is found a list of applications installed/recognized by Turbulence. It should look like:

   <!--  test application  -->
   <application serverName="fork-test" name="test app" >
      <location app-reload="application_reload" 
                src="/home/work/programas/fork-test" />
   <!--  core-admin application load  -->
   <application close-conn-on-failure="yes" 
                name="core admin" >
      <location app-reload="application_reload" 
                src="/home/work/programas/core-admin/server-component" >
         <!--  temporal pah during development or because the module is not
              installed on the system  -->
         <add-path value="/home/work/programas/core-admin" />

In this example we have two applications: "test app" and "core admin" which are located the directories configured by "src" attribute and started by the python entry file defined by "start-file" attribute.

To know more about writing mod-python applications see Writing Turbulence's mod-python applications

Note that each <application> may have a "serverName" declaration configured. This lets to know mod-python to only start those applications where the BEEP connection is bound to that serverName value (virtual hosting). Note a BEEP connection gets bounded to a serverName on first channel accepted requesting such serverName.

See following section for all details.

Configuration reference

To declare an application, add a <application> node with the following attributes:

Now, inside an <application> declared it is required a <location> node to configure where to find startup files and other settings. Attributes supported by <location> node are:

Notes about security and application isolation

Due to python global interpreter nature, all apps started inside the same process shares and access to the same data and context. Obviously this has advantages and security disadvantages. Knowing this, keep in mind the following recommendations:

Adding path to python application

It may be useful to allow including additional path from which to load python code that complete your python application. For that, you can use:

<application name="My echo profile" >
   <location src="/directory/path/to/start-file" 
             app-reload="app_reload" >
      <add-path value="/path/to/python/modules" />

Configuring mod-python search path

Currently, mod-python searches for python.conf looking for it in the following other: