Skip to content

example server.py

Michael Jolin edited this page Jul 7, 2017 · 3 revisions
import cherrypy
from cause.api.management.core.logging import Logging
from cause.api.management.config.api import ConfigApi
from cause.api.management.config import setup as config

Logging()


def run_server():
	""" Start the application
	"""
	site_config = ConfigApi()
	site_config.complete()

def application(environ, start_response):
	""" Run the web application with UWSGI
	"""
	run_server()
	return cherrypy.tree(environ, start_response)

""" Run the web application without UWSGI
"""
if __name__ == '__main__':
	cherrypy.config.update({
		'server.socket_port': config.PORT
	})

	run_server()
	cherrypy.engine.start()
Clone this wiki locally