Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyCharm + Flask: Unresolved reference - How do I properly import Python namespaces?

Tags:

python

I have added Flask and Flask-Script to PyCharm virtual environment. The app runs but PyCharm gives me various errors:

Unresolved reference "Manager" (from  flask.ext.script import Manager)
Cannot find reference "script" in "__init__.py" (from  flask.ext.script import Manager)
No module named "script" (command = flask.ext.script.Command(app)

As a result code completion doesn't work.

So if I directly import the modules like import flask_script code completion works but I am not sure if that's an intended use!

I can fix that if I import flask_script directly instead of flask.ext. Is that a valid workaround?

Is there any other proper way to solve that? I read a few answers but none of them seems to address this issue.

like image 365
Zingam Avatar asked Aug 11 '14 11:08

Zingam


1 Answers

In your venv > lib > python3.x > site-packages mark site-packages as source root.

like image 113
Ali Gajani Avatar answered Sep 21 '22 03:09

Ali Gajani