ошибка ModuleNotFoundError: No module named 'app' (python - flask)
есть файл app.py
c данным кодом
from flask import Flask, render_template, url_for
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
class Article(db.model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(100), nullable=False)
text = db.Column(db.Text, nullable=False)
date = db.Column(db.DateTime, default=datetime.utcnow)
intro = db.Column(db.String(300), nullable=False)
def __repr__(self):
return 'Article %r>' % self.id
@app.route('/')
@app.route('/home')
def index():
return render_template("index.html")
@app.route('/about_us')
def about():
return render_template("about.html")
@app.route('/user/<string:name>/<int:id>')
def user(name, id):
return "User page: " + name + " - " + str(id)
if __name__ == "__main__":
app.run(debug=True)
я не знаком с веб разработкой, только начал изучать flask по видео уроку на ютубе(https://www.youtube.com/playlist?list=PL0lO_mIqDDFXiIQYjLbncE9Lb6sx8elKA)
но столкнулся с ошибкой:
from app import db
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'app'
погуглил проблему, но ничего не сработало
from app import db
C:\Users\Danil\AppData\Local\Programs\Python\Python38\lib\site-packages\flask_sqlalchemy_init_.py:833: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. S et it to True or False to suppress this warning. warnings.warn(FSADeprecationWarning(