Flask-Web-App-Tutorial icon indicating copy to clipboard operation
Flask-Web-App-Tutorial copied to clipboard

Problem with from .import db

Open quirosaspron opened this issue 3 years ago • 2 comments

In models.py, when I run from . import db, I get the error ImportError: attempted relative import with no known parent package. Both init.py and models.py are inside the folder website. I can't find the solution anywhere, I've tried several things but none work. Please help!

quirosaspron avatar May 10 '21 17:05 quirosaspron

I get the same error when I run the file. However, if I run main.py then there is no issue. I believe you are not supposed to run auth.py and models.py directly.

abhikush avatar May 24 '21 20:05 abhikush

Yes, you are not supposed to run anything with a from . import <insert here>. Someone should close this issue now.

elpython3 avatar Jul 03 '21 23:07 elpython3