Skip to content Skip to sidebar Skip to footer

Modulenotfounderror When Attempting To Import From Outside Of Directory

I'm working on a Flask app and attempting to run my test file but unable to do so. My current app structure is: Project ── app │   ├── __init__.py │   ├── f

Solution 1:

You should add __init__.py in your tests directory. The empty __init__.py will turn that directory into a package. Then you can use this line in your test_user_model.py:

from app.modelsimportUser

See details in PEP 328.

Solution 2:

Post a Comment for "Modulenotfounderror When Attempting To Import From Outside Of Directory"