[problem description]
The author encountered a classic error in flash. The error information is as follows:
[problem analysis]
application context is the application context of Flask, which contains variables such as app and g. When it is not convenient to operate app, we use current_app instead of app. current_app can only be accessed when processing requests, and I used current_app outside of processing requests, so an error was reported. Specifically, I used current_app in a custom tool class, ran the program, and could not get the application context when the program loaded the tool class, so the error was reported. The error code is as follows.
[problem-solving]
Since you can’t use current_app in the class property in the tool class, comment out the code and put it in the class method, and modify it as follows. The class method defined by me is used in the view, so the current_app is used in the view when processing the request, so no error will be reported and the problem is solved.
Read More:
- [Solved] RuntimeError: No application found. Either work inside a view function or push an application contex
- Gunicorn timeout error: [1] [critical] worker timeout [How to Solve]
- _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
- Python Requests Error: Max retries exceeded with url
- [Solved] Python requests ConnectionError Error: connection aborted BadStatusLine
- Python requests Error: ConnectionError: (‘Connection aborted.‘, error(104, ‘Connection reset by peer‘))
- visdom Install and Run Error: raise Connectionerror [How to Solve]
- [Solved] error: when using the property decorator in Python, an error occurs: typeerror: descriptor ‘setter’ requires a ‘property’ object but
- urllib.error.HTTPError: HTTP Error 403: Forbidden [How to Solve]
- [Solved] django AttributeError: ‘UserComment‘ object has no attribute ‘save‘
- [Solved] urllib.error.URLError: <urlopen error [SSL: WRONG_VERSION_NUMBER] wrong version number
- Failed to establish a new connection: [winerror 10048] in the requests thread pool, the interface is called circularly to get the datagram error
- Django WSGI protocol application, based on wsgiref module DIY a web framework
- “NameError: name ‘re’ is not defined” [How to Solve]
- [Solved] Forbidden (403) CSRF verification failed. Request aborted.
- Extracting Data from XML (Using Python to Access Web Data)
- [Solved] Pychar error: modulenotfounderror: no module named ‘requests_ HTML ‘solution
- Python + Requests +Excel+Jenkins interface automation
- Decode PUP data Error when reading radar data [How to Solve]