Python Flask Server send_file fails when SSH terminal disconnected

0

I think this would be a useful question to others too.

I have a flask server running (on an EC2) and delivers attachments via python send_file as a request. Works great. It also provides a list of the files available. (Using your browser). The process is I SSH to the terminal start the python3 minflask.py &

I exit the SSH. All commands work for the minflask.py accept the send_file which says server error. I know the process is running. I can SSH again and see the process is running.

So instead (what works) the process is

SSH for the terminal tmux new -s mywindow python3 minflask.py

and all works. I close the SSH terminal and all works fine. Later I can tmux a -t mywindow and see my Flask server output information.

So what is the real issue HERE?

I have tried send_file with an fp=open and send_from_directory and so on. No difference. I know I can open files.

redpath
asked a year ago40 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions