后台:nginx+uwsgi+django
微信公众平台是ajax请求的吗?django该如何处理?
微信GET请求时uwsgi打印的信息:
[pid: 1797|app: 0|req: 4/4] 101.226.64.201 () {34 vars in 634 bytes} [Tue Nov 12 03:10:18 2013] GET /weixin?signature=2afa22a48e947f569fe3fd73947f822d09c3f7a1&echostr=5945719633796526203×tamp=1384247416&nonce=1384345734 => generated 0 bytes in 0 msecs (HTTP/1.0 301) 2 headers in 231 bytes (1 switches on core 0)
views.py:
def weixin(request):
echostr = request.GET.get('echostr', '')
return HttpResponse(echostr)
自己用浏览器输入http://42.96.xx.xx//weixin?signature=2afa22a48e947f569fe3fd73947f822d09c3f7a1&echostr=5945719633796526203×tamp=1384247416&nonce=1384345734 可以得到echostr