Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named flask.ext.mysql

Tags:

Hi I am trying to run a python file that has :

from flask import Flask, render_template, json, request from flask.ext.mysql import MySQL from werkzeug import generate_password_hash, check_password_hash 

I started in windows, I got the same error :

ImportError: No module named flask.ext.mysql 

Someone told me don't develop python in windows, it's lot of headache, so I started the same project in Ubuntu, but I got the same problem :

vagrant@precise32:/vagrant/FlaskMysql/FlaskApp$ python app.py Traceback (most recent call last): File "app.py", line 2, in <module> from flask.ext.mysql import MySQL File "/usr/local/lib/python2.7/dist-packages/flask/exthook.py", line 87, in    load_module raise ImportError('No module named %s' % fullname) ImportError: No module named flask.ext.mysql 

Please your help is appreciated.

like image 748
Bouchaib Mounir Avatar asked Oct 20 '15 16:10

Bouchaib Mounir


Video Answer


1 Answers

Here is the official Flask-MySQL documentation: https://flask-mysql.readthedocs.org/en/latest/# You'll find that the current import syntax is as follows:

from flaskext.mysql import MySQL 
like image 196
extrct Avatar answered Sep 24 '22 17:09

extrct