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"