Do not use flask as the primary server. It's not appropriate for production. Instead use a web server able to communicate with Flask through a WSGI protocol such as waitress. Waitress doesn't currently support TLS natively so another approach will need to be created for that also.