Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

139 support cfgfiles #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
]

Expand Down
8 changes: 6 additions & 2 deletions pywps.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ port=5000
outputurl=/wps/outputs
outputpath=/var/www/html/wps/outputs
workdir=/tmp/outputs/
logLevel=INFO
logdatabase=/tmp/outputs/pywps-logs.sqlite3
loglevel=DEBUG
logfile=/var/log/pywps/pywps.log
logdatabase=/var/log/pywps/pywps.sqlite3
maxprocesses=30
parallelprocesses=5

[grass]
gisbase=/usr/local/grass-7.3.svn/
10 changes: 6 additions & 4 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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('/')
Expand Down