i am running a simple code
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 Todo(db.Model):
id = db.Column(db.Integer, primary_key=True)
content = db.Column(db.Integer, default = 0)
data_created = db.Column(db.datetime, default=datetime.utcnow)
def __repr__(self):
return '<Task %r>' % self.id
@app.route("/")
def index():
return render_template("index.html")
if __name__ == "__main__":
app.run(debug=True)
and typing this in the terminal
python app.py
but getting error and i dont know the reason for this.
ImportError: cannot import name 'SQLALchemy' from 'flask_sqlalchemy'