from flask import Flask,request , render_template , redirect , url_for
from flask_login import LoginManager , UserMixin , login_user , login_required , logout_user , current_user
from flask_mysqldb import MySQL
from flask_bcrypt import Bcrypt
i am trying to make a login and signup page using flask. but its giving error that
prakash@prakash-laptop:~/Desktop/flask/auth_$ python3 app.py
Traceback (most recent call last):
File "/home/prakash/Desktop/flask/auth_/app.py", line 4, in <module>
from flask_mysqldb import MySQL
File "/usr/local/lib/python3.10/dist-packages/flask_mysqldb/__init__.py", line 3, in <module>
from flask import _app_ctx_stack, current_app
ImportError: cannot import name '_app_ctx_stack' from 'flask' (/home/prakash/.local/lib/python3.10/site-packages/flask/__init__.py)
i had not imported " _app_ctx_stack" then also its showing error
i tried to reinstall flask_login and flask
The error is clearly in flask_mysqldb . Perhaps the module has errors? Its not a very big project, and might have fallen out of support. Flask's most recent version was on feb 4th of 2024. flask_mysqldb was on oct 5th 2023. I highly suggest using mysql-connector-python instead.
Edit: https://github.com/miguelgrinberg/Flask-SocketIO/issues/1856 and https://github.com/fedora-copr/flask-whooshee/issues/71 both tell us that '_app_ctx_stack' has been deprecated. It is still in use in flask_mysqldb though. This seems to further reinforce my point above