Flask - ImportError: No module named app

前端 未结 7 1552
故里飘歌
故里飘歌 2020-12-15 16:31

First I created __init__.py

from flask import Flask

app = Flask(__name__)

Then in a separate file, in the same directory,

7条回答
  •  无人及你
    2020-12-15 16:42

    Your __init__.py file needs to go in the folder named app, not the same directory as the run.py file.

    from app import app is looking in the app folder, so the __init__.py file needs to sit in there.

提交回复
热议问题