Forums

NameError: name 'MySQL' is not defined

I am using mysqldb for mysql database. I tried from flask_mysqldb import MySQL but It was throwing an import error so I changed it to import MySQLdb. Now, I'm getting a NameError. What's wrong? Here is the error I'm getting:

Error running WSGI application

NameError: name 'MySQL' is not defined
File "/var/www/sujeetagrahari_pythonanywhere_com_wsgi.py", line 16, in <module>
from app import app as application 
File "/home/SujeetAgrahari/mysite/app.py", line 14, in <module>
mysql = MySQL(app)

perhaps this page will help? https://help.pythonanywhere.com/pages/DebuggingImportError -- you may need to learn a bit more about Python to be able to work through this problem?