微信公众号绑定服务器 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;
        }

 

posted @ 2018-09-11 15:10  吃饭睡觉打逗逗  阅读(375)  评论(0编辑  收藏  举报