问题
In web2py, in gluon/contrib/pymysql/connections.py there is a function that creates a new mySQL connection:
def __init__(self, host="localhost", user=None, passwd="",
db=None, port=3306, unix_socket=None,
Is there any way to pass parameters to this function from web2py?
回答1:
As noted at the very end of this section of the documentation, you can specify a dictionary of driver_args
when instantiating DAL
:
db = DAL(<connection_string>,
driver_args=dict(host='localhost', port=3306, ...))
来源:https://stackoverflow.com/questions/36648700/web2py-pass-parameters-to-db-connection