Open SwayamBadhe opened 1 year ago
You no longer have to manually check if path.exists()
in flask, instead do this
with app.app_context():
db.create_all()
this checks it for you, I believe it's already updated in the git, auth.py file though.
This is explained well in this StackOverflow discussion: https://stackoverflow.com/questions/73968584/flask-sqlalchemy-db-create-all-got-an-unexpected-keyword-argument-app
SQLAlchemy.create_all() got an unexpected keyword argument 'app'
`from flask import Flask from flask_sqlalchemy import SQLAlchemy from os import path
db = SQLAlchemy() DB_NAME = 'database.db'
def create_app(): app = Flask(name) app.config['SECRET_KEY'] = 'kjsdhfkjashfkh' app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}' db.init_app(app)
def create_database(app): if not path.exists('website/' + DB_NAME): db.create_all(app=app) print('Created Database!')`