Commit fa082e11 authored by J. Fernando Sánchez's avatar J. Fernando Sánchez
Browse files

Use flask's server by default

Using this server in production is discouraged, but to implement a
proper asynchronous server with tornado/gevent every blocking call would
have to be converted to a non-blocking call.

Failing to do so causes deadlocks like #35

For now, it is easier to just use the default server.
parent 2ea01aef
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment