I am running the following code in PyCharm and kepp getting the KeyError 'migrate'
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
basedir = os.path.abspath(os.path.dirname(__file__))
print(basedir)
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+os.path.join(basedir,'data.sqllite')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
migrate = Migrate(app, db)
I then run set FLASK_APP=app_database.py
and flask db init
in command line but I keep getting the directory = current_app.extensions['migrate'].directory
KeyError: 'migrate' error.
I am stuck. Can anybody help? Thank you very much!