Bharath Gowda
Bharath Gowda

Reputation: 47

I have initialized app but still its throwing error(Flask)

app = Flask(__name__)
app.config['SECRET_KEY'] = "nothingggg"
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///posts.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)


login_manager = LoginManager
login_manager.init_app(app)
login_manager.login_view = 'login'

`

The error i am getting is init_app() missing 1 required positional argument: 'app' Can anyone solve this?

Upvotes: 0

Views: 237

Answers (1)

Hridaya Agrawal
Hridaya Agrawal

Reputation: 325

The error is a silly one, You forgot the parentheses, So the LoginManager class won't construct

login_manager = LoginManager()
login_manager.init_app(app)
login_manager.login_view = 'login'

Upvotes: 1

Related Questions