微信公众号绑定服务器 Flask版

python 代码

from flask import Flask, request
from flask_cors import CORS

app = Flask(__name__)
app.app_context().push()


@app.route('/weixin')
def weixin():
    return request.args.get('echostr')


def runFlask(port):
    app.run(host='0.0.0.0',port=port)
    CORS(app, supports_credentials=True)


if '__main__' == __name__:
    runFlask(666)

nginx转发

        location /weixin {
            proxy_pass   http://127.0.0.1:666/weixin;
        }
原文地址:https://www.cnblogs.com/lurenjia1994/p/9627802.html