Forums

flask-mysqldb problem

i have used flask_mysqldb module for my flask app and i uploaded it to pythonanywhere with using git but there is an error message called "Error running WSGI application ModuleNotFoundError: No module named 'flask_mysqldb'" i use free mysql hosting not local server actually but that doesn't solve anything

my code like that

app = Flask(__name__)
app.secret_key = "ybblog"
app.config["MYSQL_HOST"] = "remotemysql.com" #başka sunucuda localde olmayan çalışsaydı onun adresi yazılmalı
app.config["MYSQL_USER"] = "cZ4zHMzalt"
app.config["MYSQL_PASSWORD"] = "MkHisCk3EJ"
app.config["MYSQL_DB"] = "cZ4zHMzalt"
app.config["MYSQL_PORT"] = 3306
app.config["MYSQL_CURSORCLASS"] = "DictCursor"

The specific error you're getting means that you need to install flask_mysqldb into your virtualenv -- just start a bash console inside the virtualenv using the link on the "Web" page, then use pip to install it.

However, you won't be able to connect to a remote MySQL server from a free account -- free accounts only have HTTP/HTTPS access to the external Internet, and can only access sites on our whitelist.

I installed correctly flask_mysqldb in my virtual enviroment and the error continue: ModuleNotFoundError: No module named 'flask_mysqldb'

I installed pip install flask-mysqldb not errors

Are you sure that's the latest error you are seeing?

Hi Friends. I found the solution When I run the program in the PythonAnywhere IDE; This keeps telling error me that it cannot load flask_mysqldb, but if you save the program and run it from the site, it does not mark an error and it works. you can see my API in: http://jaorsoftware.pythonanywhere.com/ Is working Greetings

ah great, for future reference, if you run from the PythonAnywhere IDE, you would need to specify which python to use.