ImportError: cannot import name 'app'
See original GitHub issue Hello,miguel。I have finished your awesome "dog book" three weeks ago, and my code bases on your code. The 'app' is created in app/__init__.py,
Now I want to add the full-text search function,but i don't know how to import 'app'.When i tried to import it directly like"from app import app", it didn't work and "ImportError: cannot import name 'app'" came out. i have try google and stackoverflow , but there were not helpful answer.
so i ask you for help. My english is not very well, hope you can understand what i say.Have a nice day!
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Flask ImportError: cannot import name app - Stack Overflow
I keep getting a ImportError: cannot import name app error on the first line of run.py . All the other questions seem to...
Read more >ImportError: cannot import name 'app' from 'app' (unknown ...
I encountered this error. It looks like my problem was was in naming the file init.py instead of init.py (with 2 underscores on...
Read more >cannot import name 'app' from 'site' : Forums - PythonAnywhere
hi there. it's my first time deploying a Flask app. ... Error running WSGI application ImportError: cannot import name 'app' from 'site' ...
Read more >Flask App shows ImportError: cannot import name 'Markup ...
Flask App shows ImportError: cannot import name 'Markup' from 'jinja2' | After deploying. Hello,. I have successfully deployed a flask web ...
Read more >cannot import name 'app' from partially initialized module 'app ...
The reason you're getting an error is because agreements.py can't import functions from approvals.py while approvals.py is simultaneously trying to import ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Your problem is that you have circular dependencies. Some of the imports in manage.py that appear before the
app = create_app()line issue afrom manage import app, and that obviously fails.Move the
from app import create_appandapp = create_applines above your other imports, maybe that’ll help.Are you using a factory function, like in the book? If you are, then
appdoes not exist as a symbol, you only havecreate_app, the function that creates it.So you need to import
appfrom the module that creates it. For example, if you callcreate_appin manage.py, then you can import it from there withfrom manage import app.