Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
db.init_app(app) Errror

Hi I am a compleat Noob (in flask), i have an Error in my Program that says: TypeError: SQLAlchemy.init\_app() missing 1 required positional argument: 'app' and i dont know what is wrong ):


This is the code pls Help me:

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'] = 'hjshjhdjah kjshkjdhjs'
    app.config['SQLALCHEMY_DATABASE_URI'] = f'sqlite:///{DB_NAME}'
    db.init_app(app) #this thing makes the problem

    from .views import views #thies are just website things
    from .auth import auth

    app.register_blueprint(views, url_prefix='/')
    app.register_blueprint(auth, url_prefix='/')

    from .models import User, Note #that are moduls for the data base

    with app.app_context():


/r/flask
https://redd.it/1kmg69c