From 58daaf7b0bef48e5499ce880907dda3a6efab163 Mon Sep 17 00:00:00 2001 From: Andreas <andreasv@fsmpi.rwth-aachen.de> Date: Sat, 18 Feb 2017 18:42:20 +0100 Subject: [PATCH] added a config option for the mysql port --- config.py.example | 1 + db.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/config.py.example b/config.py.example index e6fbed4..fdc6168 100644 --- a/config.py.example +++ b/config.py.example @@ -11,6 +11,7 @@ DB_DATA = 'db_example.sql' #DB_ENGINE = 'mysql' #MYSQL_HOST = 'localhost' #MYSQL_USER = 'videoag' +#MYSQL_PORT = '3306' #MYSQL_PASSWD = 'somuchsecret' #MYSQL_DB = 'videos' diff --git a/db.py b/db.py index b062972..dbec2ae 100644 --- a/db.py +++ b/db.py @@ -47,7 +47,7 @@ elif config['DB_ENGINE'] == 'mysql': def get_dbcursor(): if 'db' not in g or not g.db.is_connected(): - g.db = mysql.connector.connect(user=config['MYSQL_USER'], password=config['MYSQL_PASSWD'], host=config['MYSQL_HOST'], database=config['MYSQL_DB']) + g.db = mysql.connector.connect(user=config['MYSQL_USER'], password=config['MYSQL_PASSWD'], host=config['MYSQL_HOST'], port=config['MYSQL_PORT'], database=config['MYSQL_DB']) if not hasattr(request, 'db'): request.db = g.db.cursor() return request.db -- GitLab