mirror of
https://github.com/gsi-upm/senpy
synced 2024-11-21 15:52:28 +00:00
Merge branch '35-timeout-and-blocking-requests'
This commit is contained in:
commit
6d7575bbcd
@ -22,10 +22,6 @@ the server.
|
||||
|
||||
from flask import Flask
|
||||
from senpy.extensions import Senpy
|
||||
from tornado.wsgi import WSGIContainer
|
||||
from tornado.httpserver import HTTPServer
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
|
||||
import logging
|
||||
import os
|
||||
@ -78,6 +74,11 @@ def main():
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Do not run a server, only install plugin dependencies')
|
||||
parser.add_argument(
|
||||
'--threaded',
|
||||
action='store_false',
|
||||
default=True,
|
||||
help='Run a threaded server')
|
||||
parser.add_argument(
|
||||
'--version',
|
||||
'-v',
|
||||
@ -101,18 +102,10 @@ def main():
|
||||
print('Senpy version {}'.format(senpy.__version__))
|
||||
print('Server running on port %s:%d. Ctrl+C to quit' % (args.host,
|
||||
args.port))
|
||||
if not app.debug:
|
||||
http_server = HTTPServer(WSGIContainer(app))
|
||||
http_server.listen(args.port, address=args.host)
|
||||
try:
|
||||
IOLoop.instance().start()
|
||||
except KeyboardInterrupt:
|
||||
print('Bye!')
|
||||
http_server.stop()
|
||||
else:
|
||||
app.run(args.host,
|
||||
args.port,
|
||||
debug=True)
|
||||
app.run(args.host,
|
||||
args.port,
|
||||
threaded=args.threaded,
|
||||
debug=app.debug)
|
||||
sp.deactivate_all()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user