From 0afbc40a9fa04746c40f27bfffef6ba4ed462d11 Mon Sep 17 00:00:00 2001 From: Michaƫl Ball Date: Sun, 20 Dec 2015 15:50:43 +0000 Subject: Run as Gevent WSGI app --- mach2.py | 9 +++------ run_mach2.py | 7 +++++++ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 run_mach2.py diff --git a/mach2.py b/mach2.py index 8261019..a7654b1 100644 --- a/mach2.py +++ b/mach2.py @@ -21,8 +21,6 @@ from models.user import User DATABASE = "app.db" -compress = Compress() - app = Flask(__name__) app.config.from_object(__name__) @@ -34,11 +32,10 @@ app.config["SECRET_KEY"] = config["DEFAULT"]["secret_key"] login_manager = LoginManager() login_manager.login_view = "login" -config = configparser.ConfigParser() -config.read("mach2.ini") +login_manager.init_app(app) -login_manager = LoginManager() -login_manager.login_view = "login" +compress = Compress() +compress.init_app(app) def get_db(): diff --git a/run_mach2.py b/run_mach2.py new file mode 100644 index 0000000..4c12f2b --- /dev/null +++ b/run_mach2.py @@ -0,0 +1,7 @@ +from gevent import monkey +monkey.patch_all() +from gevent.wsgi import WSGIServer +from mach2 import app + +http_server = WSGIServer(('', 5000), app) +http_server.serve_forever() -- cgit v1.2.3