cannot import name 'app_ctx' from 'flask.globals'
时间: 2023-10-08 16:11:22 浏览: 68
This error occurs when you try to import the `app_ctx` object from the `flask.globals` module, but it is not available in the version of Flask you are using.
The `app_ctx` object is a Flask application context, which provides a way to share application-level data and configuration between different parts of your Flask application.
To resolve this error, you can either update your Flask installation to a version that includes the `app_ctx` object, or find an alternative way to achieve the same functionality without using `app_ctx`.
If you are using an older version of Flask and cannot update, you can use the `current_app` object instead, which provides similar functionality. However, `current_app` is only available within the context of a Flask request, whereas `app_ctx` can be used across multiple requests.