AirPlay Receiver can interfere with Flask apps
It listens on port 5000, which is the default port used for running Flask apps in debug mode, then Safari sends blank pages for my Flask app.
One persistent issue I have when developing apps with Flask is that I’ll go through several rounds of iteration, run the app with the debug server, and at some point Safari will stop loading the app. If I try to load the app in Safari, I just get blank pages. Other browsers are fine, but Safari is broken until I restart it.
I hadn’t spotted the pattern, but today Brian explained what’s going on: the default port for the Flask dev server is port 5000, and my Mac is listening on port 5000 for AirPlay. If I run the dev server with the default port, at some point Safari connects to the AirPlay Server instead of my app, and then it starts receiving blank pages.
There are two workarounds:
Use a different port to run my Flask apps.
Disable AirPlay Receiver in Settings: General > AirDrop & Handoff > AirPlay Receiver.
I’ve done the latter, because I never need to AirPlay to my Macs.
This isn’t the first time I’ve had to disable a setting in the “AirDrop & Handoff” screen.