[Solved] FLask Error: AttributeError: ‘Blueprint‘ object has no attribute ‘register_blueprint‘

Recently, a flash was deployed on alicloud, and an error was reported during startup

AttributeError: ‘Blueprint’ object has no attribute ‘register_blueprint’

I checked the location. There was an error below!

admin_bp = Blueprint('admin',__name__)
admin_bp.register_blueprint(activity_bp,url_prefix='/activity')

First of all, there is no problem running locally. When uploading to the server (CentOS 7, py39), an error is reported. Maybe it is because it is not standardized, but it should also be reported on the window. I don’t understand.

Solution:

Blueprint cannot call Method of register_blueprint(), register_Blueprint() is handed over to the app, and this line is moved to the place where the app is referenced

app.register_blueprint(activity_bp,url_prefix='/activity')

This should be no problem!

Read More: