Article From:

A small project: visit a URL, automatically generate a PDF. After deploying it to the company’s server with flaks, it is normal to work after connecting to VPN, but if the VPN is disconnected and reconnected to VPN, the URL cannot be accessed and the flask service must be restarted. Excuse meOnce the service is released, it will always be available if it is connected to VPN (even if it is broken and reconnected again).

if __name__ == '__main__':,host='',port=5000)

Answer 0:

You can consider script implementation, VPN connection and flask startup in a script. When the VPN connection is successful, execute the statement that starts flask, such aspython path/to/。Provide a way of thinking…

Answer 1:

Try this.

if __name__ == '__main__':,host='',port=5000)

Answer 2:

I think it may be related to the implementation of flask, plus debug. Recommend uwsgi, nginx try.

Link of this Article: Python flask failure problem

Leave a Reply

Your email address will not be published. Required fields are marked *