This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

django-wechat 是一个微信公众号 django 开发库

Project Description
# django-wechat
微信公众号 django 开发库

`wechat-python-sdk`是一个微信sdk库,负责和微信的api通信。
但是在多进程环境中,每个进程都会维护自己的一份`Access Token`(同理`JsApi Ticket`),
并且会导致其他进程的`Access Token`失效,所以我们需要一种持久化的方式,让多个进程统一获取和更新一份`Access Token`。

`django-wechat`通过数据库持久化解决了这个问题,并且支持同时使用多个公众号。

Quick start
-----------

1 添加 "djwechat" 到 INSTALLED_APPS中
```
INSTALLED_APPS = (
...
'djwechat',
)
```

2 运行 `python manage.py migrate`,以创建 django-wechat models.

3 在admin后台,添加对应微信号的账号认证信息 和 JsApiList

1)账号认证信息的值为:

```
{
"WEIXIN_TOKEN": "6G9IH7EF4D83C5AB",
"WEIXIN_APP_ID": "wx67fb1f4877bfd511",
"WEIXIN_APP_SECRET": "646332665dcd63f9e8b83a474f2dbe38",
"WEIXIN_ENCODING_AES_KEY": "ZvhDvkQ8QpRUvNZUQgDRvrU3ICQEBVEdLvEsmsXTscA"
}
```

2)已申请的JsApiList权限,以空格隔开,如下所示:

```
scanQRCode getLocation getNetworkType onMenuShareTimeline onMenuShareAppMessage onMenuShareQQ onMenuShareWeibo chooseWXPay
```

4 在 `django` 中使用

```
from djwechat.util import get_wechat
appid = 'XXXXXXXXXXXXXXXXXX'
wechat = get_wechat(appid)
....
```

djwechat会自动在数据库中保存和更新 access_token、jsapi_ticket, 用户只需负责调用就行。
Release History

Release History

This version
History Node

0.2.1

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-wechat-sdk-0.2.1.tar.gz (9.6 kB) Copy SHA256 Checksum SHA256 Source Mar 29, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting