Forums

No module named flaskext

I am trying to deploy python-flask app through pythonanywhere.com. However, it gives me an error saying No module named flaskext.mysql even though it worked when I tested with localhost.

from flask import Flask, render_template, json, request,redirect,session
from flaskext.mysql import MySQL
from werkzeug import generate_password_hash, check_password_hash

mysql = MySQL()
app = Flask(__name__)
app.secret_key = 'why would I tell you my secret key?'

I of course installed pip install flask and pip install flask-mysql and from flask_mysql import MySQL. I tried all that I can T.T I am using python3.4. I can't find the reason..Please help help!

Does this help? https://help.pythonanywhere.com/pages/DebuggingImportError

No it didn't. I still couldn't figure out why it happens.

I tried with flask_mysqldb after install flask-mysql. However, it also doesn't work saying no module named flask_mysqldb. So, in my case flaskext.mysql, flask_mysql, flask_mysqldb don't work at all on both python2.7 and 3.4.

Can you give more details like how you did the installation? eg: did you do it using the --user flag? or did you try to install into a virtualenv? what was the exact command that you used?

I am getting the same problem, if this has been resolved I'd like to know. :)

It's not a general system problem that we can resolve -- it's a configuration problem for a given site. Is the error you getting the "no module named flaskext" one? I see your website is using a virtualenv -- have you installed the flaskext package?

Don't know if anyone still reads this, but I had the same problem with flask_mysqldb when writing my code with VS Code and then running it over the terminal. Interestingly, the problem was solved when I ran my program using PyCharm. But I don't know neither how to solve the problem with PythonAnywhere, currently facing the same issue

Have you used the pip command to install the flask_mysqldb package? More information on this help page.