是否可以使用单个Flask应用程序在两个不同的端口上设置路由?我的Flask应用程序需要监听Webhooks,由于某些安全问题,它不能在默认端口上接收外部POST请求。是否可以像这样做?
@app.route('/hook/<sourcename>', methods=["POST"], port=5051)
def handle_hook(sourcename):
print 'asdf'
import gevent
from gevent.pywsgi import WSGIServer
app = Flask(__name__)
https_server = WSGIServer((HOST, HTTPS_PORT), app, keyfile=PRIVKEY, certfile=CERT)
https_server.start()
http_server = WSGIServer((HOST, HTTP_PORT), app)
http_server.start()
while True:
gevent.sleep(60)