Running flask in a thread with Kivy causes no requests to be printed out
See original GitHub issueExpected Behavior
Server errors or I see a traceback. I’m trying to run a little flask app as part of a kivy frontend (goal to make a multiplayer card game app). In a later endpoint I typed njwfnof
to simulate an error and nothing happened when the endpoint was hit. Is this intended?
class FlaskThread(Thread):
def __init__(self, *args, **kwargs):
self.root = kwargs.pop('root')
super().__init__(*args, **kwargs)
def run(self):
app.root = self.root
app.run(
host='127.0.0.1', port=8888, debug=True, use_debugger=True,
# setting use_reloader to False because it can't be True if not run in main thread
use_reloader=False)
Actual Behavior
Server stays up but nothing happens
Environment
- Python version: 3.6.4
- Flask version: Flask 1.0.2
- Werkzeug version: 0.14.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (6 by maintainers)
Top Results From Across the Web
How to run kivy and flask apps together? - Stack Overflow
I found out Flask is blocking Kivy and vice versa no matter the timing or how arranged are the threads. The reason being...
Read more >Kivy+Flask Application - Raspberry Pi Forums
Hello, I was trying to create a Kivy gui app with a flask server running in the background, but I had little success....
Read more >How to Kill a Python Thread - miguelgrinberg.com
I'm often asked how to kill a background thread, and the answer to this question makes a lot of people unhappy: threads cannot...
Read more >buildozer - PyPI
Syntax error in Kivy and KivyMD dependencies file when using Buildozer to compile KivyMD app #1051; Adding CFFI as a Buildozer requirement breaks...
Read more >Resolve TypeError: 'str' object is not callable in Python
Cause of TypeError: 'str' object is not callable in Python. This is a common error that occurs when the user declares a variable...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
aHa! I found it: https://github.com/kivy/kivy/blob/master/kivy/logger.py#L324 yeah looks like kivy’s logger is blocking other loggers, since
flask
logs things under theflask
namespace. Time to close this issue!i strongly suspect that the kivy logging setup might in turn cause flask not to apply its default logging setup as logging was “set up” by kivy - but i am completely unfamiliar with kivy