From 718fafe0a05c4d0e5a281fabf0b94d58371fde0f Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Sun, 27 Aug 2017 02:22:03 +0000 Subject: [PATCH] Add redis to requirements and test for uwsgi to monkeypatch --- requirements.txt | 3 ++- webapp/titanembeds/app.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index 5a6d429..834037d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,5 @@ paypalrestsdk https://github.com/TitanEmbeds/discord.py/archive/async.zip#egg=discord.py[voice] asyncio_extras kombu -redis \ No newline at end of file +redis +aioredis \ No newline at end of file diff --git a/webapp/titanembeds/app.py b/webapp/titanembeds/app.py index f1d1c39..837c4d1 100644 --- a/webapp/titanembeds/app.py +++ b/webapp/titanembeds/app.py @@ -7,12 +7,17 @@ from .blueprints import api, user, admin, embed, gateway import os from titanembeds.database import get_administrators_list -if config.get("websockets-mode", None) == "eventlet": - import eventlet - eventlet.monkey_patch() -elif config.get("websockets-mode", None) == "gevent": +try: + import uwsgi from gevent import monkey monkey.patch_all() +except: + if config.get("websockets-mode", None) == "eventlet": + import eventlet + eventlet.monkey_patch() + elif config.get("websockets-mode", None) == "gevent": + from gevent import monkey + monkey.patch_all() os.chdir(config['app-location']) app = Flask(__name__, static_folder="static")