I have tried both
from flask.ext.sqlalchemy import SQLAlchemy
and
from flask_sqlalchemy import SQLAlchemy
inside flask/esk I only have a __init__.py and a __init__.pyc, and inside flask_sqlalchemy I only have _compat.py, _coompat.pyc, __init__.py and __init__.pyc. Should I copy the SQLAlchemy package in to one of these directories? I read here that ext is deprected so I'm unsure.
stack-overflow deprected flask ext
I'm getting these errors
ImportError: No module named flask_sqlalchemy
and
ImportError: No module named flask.ext.sqlalchemy
I installed with pip
Flask-SQLAlchemy doesn't come with Flask. You need to install it. You are correct, flask.ext is deprecated, but all it is is a "shortcut" for accessing other installed packages that are Flask extensions. Since you haven't installed Flask-SQLAlchemy, you can't import it.
$ pip install flask-sqlalchemy
It is bad practice to manually install libraries to the system Python location (sudo pip). Use a virtualenv.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With