Forums

Error running WSGI application

I get the following error that I don't understand, I have the flask_mysqldb module installed so I don't quite understand why it gives me an error

Error running WSGI application 2023-06-09 12:21:54,001: ModuleNotFoundError: No module named 'flask_mysqldb' 2023-06-09 12:21:54,002: File "/var/www/apenaranda_pythonanywhere_com_wsgi.py", line 16, in <module> 2023-06-09 12:21:54,002: from app import app as application # noqa 2023-06-09 12:21:54,002: 2023-06-09 12:21:54,002: File "/home/apenaranda/APP-POWERBY/app.py", line 2, in <module> 2023-06-09 12:21:54,003: from flask_mysqldb import MySQL 2023-06-09 12:21:54,003: ******* 2023-06-09 12:21:54,003: If you're seeing an import error and don't know why, 2023-06-09 12:21:54,003: we have a dedicated help page to help you debug: 2023-06-09 12:21:54,003: https://help.pythonanywhere.com/pages/DebuggingImportError/ 2023-06-09 12:21:54,004: *******

Make sure that you installed the missing package for the same Python version / virtual environment that runs your web app, and reloaded the web app afterwards.

when I do an install of flask_mysqldbI get the following

Defaulting to user installation because normal site-packages is not writeable Looking in links: /usr/share/pip-wheels Requirement already satisfied: flask_mysqldb in ./.local/lib/python3.10/site-packages (1.0.1) Requirement already satisfied: mysqlclient>=1.3.7 in ./.local/lib/python3.10/site-packages (from flask_mysqldb) (2.1.1) Requirement already satisfied: Flask>=0.12.4 in ./.local/lib/python3.10/site-packages (from flask_mysqldb) (2.3.2) Requirement already satisfied: itsdangerous>=2.1.2 in /usr/local/lib/python3.10/site-packages (from Flask>=0.12.4->flask_mysqldb) (2.1.2) Requirement already satisfied: click>=8.1.3 in ./.local/lib/python3.10/site-packages (from Flask>=0.12.4->flask_mysqldb) (8.1.3) Requirement already satisfied: Jinja2>=3.1.2 in /usr/local/lib/python3.10/site-packages (from Flask>=0.12.4->flask_mysqldb) (3.1.2) Requirement already satisfied: Werkzeug>=2.3.3 in ./.local/lib/python3.10/site-packages (from Flask>=0.12.4->flask_mysqldb) (2.3.4) Requirement already satisfied: blinker>=1.6.2 in ./.local/lib/python3.10/site-packages (from Flask>=0.12.4->flask_mysqldb) (1.6.2) Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.10/site-packages (from Jinja2>=3.1.2->Flask>=0.12.4->flask_mysqldb) (2.1.2)

What is asdasdasdsa?

Sorry, I already changed it to flask_mysqldb

It looks like you're installing it into your userspace for Python 3.10 -- is it the environment that you run your web app with? If you're using a virtual environmnet for the web app, you need to install the package in this venv.