Commit fc77345c authored by Julian Rother's avatar Julian Rother
Browse files

Enabled unix domain socket support for mysql

parent dab1545c
......@@ -11,7 +11,8 @@ DB_DATA = 'db_example.sql'
#DB_ENGINE = 'mysql'
#MYSQL_HOST = 'localhost'
#MYSQL_USER = 'videoag'
MYSQL_PORT = 3306
#MYSQL_PORT = 3306
#MYSQL_UNIX = '/var/run/mysqld/mysqld.sock'
#MYSQL_PASSWD = 'somuchsecret'
#MYSQL_DB = 'videos'
......
......@@ -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'], port=config['MYSQL_PORT'], database=config['MYSQL_DB'])
g.db = mysql.connector.connect(user=config['MYSQL_USER'], password=config['MYSQL_PASSWD'], host=config.get('MYSQL_HOST', None), port=config.get('MYSQL_PORT', 3306), unix_socket=config.get('MYSQL_UNIX', None), database=config['MYSQL_DB'])
if not hasattr(request, 'db'):
request.db = g.db.cursor()
return request.db
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment