I have a project structure as follows:
/src
__init__.py
manage.py
In __init__.py
, I have a variable app
declared as app = Flask(__name__)
.
When trying to import the variable app
into manage.py
using from src import app
, I get the error ImportError: cannot import name 'app' from 'src' (unknown location)
.
Reading other posts, it seems a common consensus is to use from . import app
, which yields ImportError: attempted relative import with no known parent package
.
How can I solve this?
1