Hi all,
Relatively new to Python, quite new to putting it on the web.
I'm working on a Flask project that (in part) takes some input from checkboxes, runs that through (what I believe you'd call) my main app page where I've also imported a function that works with the checkbox input, and spits the output from a function onto an HTML page in text format. I've gotten it to do that perfectly fine, except something somewhere in the process is caching the output in a way that makes it add onto itself. So, for example, if output #1 was "kitty" and output #2 was "puppy," I clicked output #1 and got the result and then refreshed it would resend and read "kitty kitty" or if I wen back and checked the box for output #2 and went forward it would read "kitty puppy," etc.
So, HOURS of looking things up, trying different things and having them fail has lead me to suspect this is a pythonanywhere-specific problem, as detailed here: https://help.pythonanywhere.com/pages/Buffering/
I tried throwing
headers['X-Accel-Buffering'] = 'no'
into my main my main app page in what seemed like the appropriate place, and then what seemed like a probably inappropriate place, and all it did was break the page where the output displays. Error log informs me that "name 'headers' is not defined."
Any more-detailed info on how to make pythonanywhere's buffering workaround work would be greatly appreciated. I assume there's something I need to import, and a specific place one needs to plug the pythonanywhere buffer workaround code above into one's app page, but I just don't seem to be able to figure that out. Help?