Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Video AG Infrastruktur
website
Commits
fc77345c
Commit
fc77345c
authored
Feb 21, 2017
by
Julian Rother
Browse files
Enabled unix domain socket support for mysql
parent
dab1545c
Changes
2
Hide whitespace changes
Inline
Side-by-side
config.py.example
View file @
fc77345c
...
...
@@ -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'
...
...
db.py
View file @
fc77345c
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment