Forums

Module not found

Hi guys,

my flask app does not load an installed module. How can I fix that? Here is what I did:

1) Go to bash console 2) workon my-virtualenv 3) pip install Flask-Cors 4) Go to mysite/flask_app.py 5) Add from flask_cors import CORS, cross_origin 6) Run app 7) Getting result:

Traceback (most recent call last): File "/home/ehlersanalytics/mysite/flask_app.py", line 5, in <module> from flask_cors import CORS, cross_origin ModuleNotFoundError: No module named 'flask_cors'

Did I install it the right way? What can I do?

Cheers

M

Ok, a proper shebang did the trick.

If you're running stuff from a console, then yes, a shebang is the solution. It's worth noting, though, that running a Flask app in a console won't put it online -- you'll need to configure it on the "Web" tab.