First I created __init__.py
from flask import Flask
app = Flask(__name__)
Then in a separate file, in the same directory, run.py
from app import app
app.run(
debug = True
)
When I try to run run.py
, I get the error
Traceback (most recent call last):
File "run.py", line 1, in <module>
from app import app
ImportError: No module named app
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…