From PyWPS
Jump to: navigation, search

The pywps configuration file can be read or manipulated inside the process execution


To access the configuration file during run time the config object has to be loaded into the code:

import pywps.config


The pywps.config is based on the ConfigParser (Configuration File Parser) [1], basically the configuration file consists of sections, led by a [section] header and followed by name=value entries.

The method getConfigValue(<section>,<name>) will return the value contained in the pywps configuration file, for example a section like:


The projs values can be read as follows:


The pywps config class extends ConfigParser and will differenciate between boolean and string, for example the following situation:

phoneFacsimile=+1 555 325 125

The getConfigValue("provider","phoneVoice") will return a python boolean that can be used in any logic system (if, while etc), while the getConfigValue("provider","phoneFacsimile") will return a python string type.


The running process can overwrite configurationvalues, note that the value will be overwritten on the process instance (code being run) and not the file it self. The setConfigValue(<section>,<name>,<value>) For example to overwrite the maxfilesize:

pywps.config.setConfigValue("server","maxfilesize", str(0))

NOTE: the <value> argument has to be string-type and shouldn't be numerical or None


In case of need the configuration file can be reloaded and any modified values will return to their originals.


the loadConfiguration() by default will try to read the configuration file defined in the pywps install (PYWPS_CFG). If necessay the method will accept a new configuration file to read: