From 7928c16c07c72c0d6ec4833ec4beafd54160a44a Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 27 May 2021 01:52:30 +0200 Subject: [PATCH] [db] Try mysqlclient first, maybe the user managed to get it working on Windows --- flaschengeist/config.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flaschengeist/config.py b/flaschengeist/config.py index 9820e9e..e06fcae 100644 --- a/flaschengeist/config.py +++ b/flaschengeist/config.py @@ -69,7 +69,12 @@ def configure_app(app, test_config=None): config["DATABASE"]["engine"] = "sqlite" if config["DATABASE"]["engine"] == "mysql": - engine = "mysql" + ("+pymysql" if os.name == "nt" else "") + engine = "mysql" + try: + # Try mysqlclient first + from MySQLdb import _mysql + except ModuleNotFoundError: + engine += "+pymysql" options = "?charset=utf8mb4" elif config["DATABASE"]["engine"] == "postgres": engine = "postgresql+psycopg2"