I have the following directory structure for my Flask project
├── API
│ ├── __init__.py
│ ├── controllers.py
│ ├── models.py
│ └── test
│ ├── first_test.py
│
├── config.py
├── requirements.txt
├── run.py
└── setup.py
My setup.py looks like following:
from setuptools import setup
setup(
name='project_name',
packages=['API'],
include_package_data=True
)
I'm concerned about how can I import my models and app (__init__) into my test files (first_test.py).
So, far I have tried
from project_name.API import app
gives from project_name.API import app
E ImportError: No module named project_name.API
from ..API import app
from ..API import app
E ValueError: Attempted relative import in non-package
and
from .. import app
from .. import app
E ValueError: Attempted relative import in non-package
I can't figure out how to import the files. Also, I running the test files with py.test API/test/first_test.py