Forums

pythonanywhere flask app outer database

Hi i just want to connect my flask app to an outer db located on freemysqlhosting.net but i cant it tells me this error; (2003, "Can't connect to MySQL server on 'sql 4.free mysql hosting.net' (111)") Which on further research means that the flask app (python) requests the database host locally on 111 and can not find it. I went on my .local/ lib / ,, python version i had on the web(python3.6)/site-packages/, to the init file and changed the default value 'local' to the my new host app.config.setdefault('MYSQL_HOST', 'freemysqlhosting.net ')

It somehow still doesnt work I have also heard that i might need access to my.cnf to change bind-address = mydbseveraddress but i dont know how to do that i tried but i dont think i have the permission

If anyone knows how to solve this please message me . Thank you!

You cannot connect out of PythonAnywhere to an external database from a free account. Free accounts can only connect out using http(s) to our whitelist of sites and a database connection is not an http(s) connection.