Tag Archives: Flask Error

[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!

[Solved] Flask Error: RuntimeError: The session is unavailable because no secret key was set.

RuntimeError: The session is unavailable because no secret key was set. Set the secret_ key on the application to something unique and secret.

When we run the flash project on the Linux system, we encounter this error:

Solution:

Basically, on the Internet, you can set secret under the flash object app_ Key:
if it is added to the startup file of my project, I can successfully run the project under windows10. If it cannot succeed on the Linux system, it still reports an error

if it is added to the startup file of my project, it can run successfully on Linux