[db] Try mysqlclient first, maybe the user managed to get it working on Windows
This commit is contained in:
parent
7b5f854d51
commit
7928c16c07
|
@ -69,7 +69,12 @@ def configure_app(app, test_config=None):
|
||||||
config["DATABASE"]["engine"] = "sqlite"
|
config["DATABASE"]["engine"] = "sqlite"
|
||||||
|
|
||||||
if config["DATABASE"]["engine"] == "mysql":
|
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"
|
options = "?charset=utf8mb4"
|
||||||
elif config["DATABASE"]["engine"] == "postgres":
|
elif config["DATABASE"]["engine"] == "postgres":
|
||||||
engine = "postgresql+psycopg2"
|
engine = "postgresql+psycopg2"
|
||||||
|
|
Loading…
Reference in New Issue