From 9010542127338db287d6469a7e2ce0b46c189863 Mon Sep 17 00:00:00 2001 From: checktheroads Date: Tue, 28 May 2019 14:14:42 -0700 Subject: [PATCH] gunicorn & wsgi config changes --- hyperglass/gunicorn_config.py.example | 11 ++++++++++- hyperglass/wsgi.py | 13 +++---------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/hyperglass/gunicorn_config.py.example b/hyperglass/gunicorn_config.py.example index cba6ac7..124f51b 100644 --- a/hyperglass/gunicorn_config.py.example +++ b/hyperglass/gunicorn_config.py.example @@ -1,8 +1,17 @@ import multiprocessing command = "/usr/local/bin/gunicorn" -pythonpath = "/opt/hyperglass/hyperglass" +pythonpath = "/opt/hyperglass" bind = "[::1]:8001" +preload = True workers = multiprocessing.cpu_count() * 2 user = "www-data" timeout = 60 +keepalive = 10 + + +def on_starting(server): + import hyperglass + + hyperglass.render.css.renderTemplate() + print(1) diff --git a/hyperglass/wsgi.py b/hyperglass/wsgi.py index 716aafd..0ba0dd9 100644 --- a/hyperglass/wsgi.py +++ b/hyperglass/wsgi.py @@ -1,17 +1,10 @@ -#!/usr/bin/env python3 import os -import hyperglass -from hyperglass.hyperglass import app +import hyperglass.hyperglass -application = app +application = hyperglass.hyperglass.app hyperglass_root = os.path.dirname(hyperglass.__file__) static = os.path.join(hyperglass_root, "static") if __name__ == "__main__": - try: - hyperglass.render.css.renderTemplate() - hyperglass.render.html.renderTemplate() - application.run(static_folder=static) - except: - raise + application.run(static_folder=static)