python - Peewee - Can't connect to MySQL server on host -
i'm developing flask based python app using peewee orm. connecting database being stored locally on machine , i'm trying transition connecting db remotely. i've set database in phpmyadmin via server's cpanel section.
the issue
i've set ip address able remotely access databases getting following error when attempt connect database:
traceback (most recent call last): file "app.py", line 294, in <module> models.initialize() file "/users/wyssuser/desktop/dscraper/models.py", line 145, in initialize database.connect() file "/library/python/2.7/site-packages/peewee.py", line 2767, in connect self.__local.closed = false file "/library/python/2.7/site-packages/peewee.py", line 2688, in __exit__ reraise(new_type, new_type(*exc_value.args), traceback) file "/library/python/2.7/site-packages/peewee.py", line 2766, in connect **self.connect_kwargs) file "/library/python/2.7/site-packages/peewee.py", line 3209, in _connect return mysql.connect(db=database, **conn_kwargs) file "/library/python/2.7/site-packages/pymysql/__init__.py", line 88, in connect return connection(*args, **kwargs) file "/library/python/2.7/site-packages/pymysql/connections.py", line 644, in __init__ self._connect() file "/library/python/2.7/site-packages/pymysql/connections.py", line 869, in _connect raise exc peewee.operationalerror: (2003, "can't connect mysql server on '142.157.25.22' ([errno 61] connection refused)")
this portion of code references database connection:
app.py
if __name__ == '__main__': models.initialize() app.run(debug=debug, port=port, host=host)
config.py
database = { 'db': 'my_dbname', 'host': '142.157.25.22', 'port': 3306, 'user': 'my_username', 'passwd': 'my_pswd', }
models.py
from peewee import * import config database = mysqldatabase(config.database['db'], host=config.database['host'], port=config.database['port'], user=config.database['user'], passwd=config.database['passwd']) ...all of models related code def initialize(): print 'starting db connection' database.connect() print 'connected' database.create_tables([batch, company, user, post],safe=true) database.close()
i've tried connecting 'localhost' host doesn't seem work here, there different host should connecting to?
Comments
Post a Comment