2013-04-30 09:49:34 +04:00
|
|
|
|
|
|
|
import cherrypy
|
|
|
|
from orun import js
|
|
|
|
from orun import app
|
|
|
|
|
2018-08-15 10:47:05 +03:00
|
|
|
config = {
|
|
|
|
'global' : {
|
|
|
|
'server.max_request_body_size' : 0,
|
|
|
|
'server.socket_timeout' : 60
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-30 09:49:34 +04:00
|
|
|
class Application(app.Application):
|
|
|
|
def index(self):
|
|
|
|
return 'Orun application server is running'
|
|
|
|
index.exposed = True
|
|
|
|
|
2018-08-15 10:47:05 +03:00
|
|
|
def run(self, port=8080, user_config=None):
|
2013-04-30 09:49:34 +04:00
|
|
|
super(Application, self).run()
|
2018-08-15 10:47:05 +03:00
|
|
|
if user_config:
|
|
|
|
config.update(user_config)
|
2013-04-30 09:49:34 +04:00
|
|
|
cherrypy.quickstart(self, '/', config)
|
|
|
|
|
|
|
|
class JsManager(object):
|
|
|
|
def write(self, data):
|
|
|
|
cherrypy.response.body.append(data)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return ';\n'.join(cherrypy.response.body) + ';'
|
|
|
|
|
|
|
|
# Auto start cherrypy javascript manager
|
|
|
|
js.js_manager = JsManager()
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
app = Application()
|
|
|
|
app.run()
|