From ac622e6f43035a16c1af51cee4589641065d2ba8 Mon Sep 17 00:00:00 2001 From: Jachym Cepicky Date: Wed, 22 Jun 2016 11:46:15 +0200 Subject: [PATCH 1/2] config --- pywps.cfg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pywps.cfg b/pywps.cfg index eac0630..cb29273 100644 --- a/pywps.cfg +++ b/pywps.cfg @@ -32,6 +32,9 @@ outputurl=/wps/outputs outputpath=/var/www/html/wps/outputs workdir=/tmp/outputs/ logLevel=INFO -logdatabase=/tmp/outputs/pywps-logs.sqlite3 +logdatabase=/var/log/pywps/pywps.sqlite3 maxprocesses=30 parallelprocesses=5 + +[grass] +gisbase=/usr/local/grass-7.3.svn/ From a782c8e188a56ad0893094e285dadf6f2b11a9ed Mon Sep 17 00:00:00 2001 From: Jachym Cepicky Date: Wed, 29 Jun 2016 21:35:07 +0200 Subject: [PATCH 2/2] adding support for more configuration files --- demo.py | 4 ++-- pywps.cfg | 3 ++- server.py | 10 ++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/demo.py b/demo.py index d8f4ab7..60f5af9 100755 --- a/demo.py +++ b/demo.py @@ -31,7 +31,7 @@ def main(): parser.add_argument('-w', '--waitress', action='store_true') parser.add_argument('-d', '--daemon', action='store_true') args = parser.parse_args() - + if args.daemon: pid = None try: @@ -70,7 +70,7 @@ def start(args, kill = None): # List of servers to start up server_list = [ - Server(processes=processes, host='0.0.0.0', port=5001, config_file=config_file), + Server(processes=processes, host='0.0.0.0', port=5001, config_files=[config_file]), Server(processes=processes, host='0.0.0.0', port=5002) ] diff --git a/pywps.cfg b/pywps.cfg index cb29273..8c2192d 100644 --- a/pywps.cfg +++ b/pywps.cfg @@ -31,7 +31,8 @@ port=5000 outputurl=/wps/outputs outputpath=/var/www/html/wps/outputs workdir=/tmp/outputs/ -logLevel=INFO +loglevel=DEBUG +logfile=/var/log/pywps/pywps.log logdatabase=/var/log/pywps/pywps.sqlite3 maxprocesses=30 parallelprocesses=5 diff --git a/server.py b/server.py index 924f3d1..70effc6 100644 --- a/server.py +++ b/server.py @@ -7,12 +7,14 @@ class Server(PyWPSServerAbstract): - def __init__(self, host=None, port=None, debug=False, processes=[], config_file=None): + def __init__(self, host=None, port=None, debug=False, processes=[], + config_files=None): + self.app = flask.Flask(__name__) # Load config files and override settings if any file specified - if config_file: - configuration.load_configuration(config_file) + if config_files: + configuration.load_configuration(config_files) self.host = configuration.get_config_value('server', 'url').split('://')[1] self.port = configuration.get_config_value('server', 'port') if self.port: @@ -41,7 +43,7 @@ def __init__(self, host=None, port=None, debug=False, processes=[], config_file= raise NoApplicableCode('File error: Could not create folder. %s' % e) self.processes = processes - self.service = Service(processes=self.processes) + self.service = Service(processes=self.processes, cfgfiles=config_files) def run(self): @self.app.route('/')