def start(args, kill=None): config_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "pywps.cfg") processes = [ FeatureCount(), SayHello(), Centroids(), UltimateQuestion(), Sleep(), Buffer(), Area(), Box(), Warp() ] s = Server(processes=processes, config_file=config_file) # TODO: need to spawn a different process for different server if args.waitress: import waitress from pywps import configuration configuration.load_configuration(config_file) host = configuration.get_config_value('wps', 'serveraddress').split('://')[1] port = int(configuration.get_config_value('wps', 'serverport')) waitress.serve(s.app, host=host, port=port) else: s.run()
from processes.sayhello import SayHello from processes.feature_count import FeatureCount from processes.buffer import Buffer from processes.area import Area from processes.bboxinout import Box from processes.jsonprocess import TestJson app = flask.Flask(__name__) processes = [ FeatureCount(), SayHello(), Centroids(), UltimateQuestion(), Sleep(), Buffer(), Area(), Box(), TestJson() ] # For the process list on the home page process_descriptor = {} for process in processes: abstract = process.abstract identifier = process.identifier process_descriptor[identifier] = abstract # This is, how you start PyWPS instance service = Service(processes, ['pywps.cfg'])
execfile(activate_this, dict(__file__=activate_this)) import os #this 4 lines are needed only for the develop installation import sys sys.stdout = sys.stderr sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "./"))) sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))) from pywps.server.wsgi import application from processes.sleep import Sleep from processes.dummy import Dummy from processes.buffer import Buffer #PyWPS configuration file pywps_configuration_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "pywps.cfg") #PyWPS processes pywps_processes = [Sleep(), Dummy(), Buffer()] if __name__ == '__main__': #run PyWPS as a demo application locally application.run_pywps(processes=pywps_processes, configuration_file=pywps_configuration_file, run_locally=True) else: #let be PyWPS served by a web server application.run_pywps(processes=pywps_processes, configuration_file=pywps_configuration_file)