I have a Python Flask server that uses HTTPS. When I press CTRL-C to complete, the list continues to work (I need to run in the shell: sudo fuser 8080/tcp -kto kill it). I need a better way to free him. Does anyone know the correct flash drive code to use?
import sys
import os
import signal
from flask import Flask, render_template, url_for, current_app, request
from OpenSSL import SSL
def signal_handler(signal, frame):
print('Clean-up')
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
context = SSL.Context(SSL.SSLv23_METHOD)
context.use_privatekey_file('server.key')
context.use_certificate_file('server.crt')
app = Flask(__name__)
@app.route("/<arg1>")
def route1(arg1):
return render_template("flask_page1.html", var1=arg1)
app.run(host="0.0.0.0", port=8080, debug=False, ssl_context=context)
Python 2.7, Raspberry Pi works with Raspbian
source
share