在新浪sae上部署WeRoBot

  花了整整一个下午,终于在新浪sae部署完成WeRoBot,现在将其中的曲折记录下来。

  首先下载WeRoBot-SAE-demo,按照README.md中的要求,执行下述命令:

git clone git://github.com/whtsky/WeRoBot-SAE-demo.git
cd WeRoBot-SAE-demo
virtualenv --no-site-packages .
source bin/activate
pip install sae-python-dev
saecloud install werobot

 

  然后编辑config.yaml文件,更改其中的name

  接着打包该路径下的所有文件:

zip -r data.zip ./*

  进入新浪sae的代码管理界面,将刚才打包好的文件data.zip上传到代码库中。

  此时,访问sae应用的链接还有问题,如下(来自网络):

Traceback (most recent call last):
  File "/data1/www/htdocs/783/booksearcher/1/index.wsgi", line 14, in <module>
    from baymax import robot
  File "/data1/www/htdocs/783/booksearcher/1/baymax.py", line 4, in <module>
    robot = werobot.WeRoBot(token='kidult00')
  File "/data1/www/htdocs/783/booksearcher/1/site-packages/werobot/robot.py", line 47, in __init__
    filename=os.path.abspath("werobot_session")
  File "/data1/www/htdocs/783/booksearcher/1/site-packages/werobot/session/filestorage.py", line 20, in __init__
    self.db = dbm.open(filename, "c")
  File "/usr/local/sae/python/lib/python2.7/anydbm.py", line 85, in open
    return mod.open(file, flag, mode)
  File "/usr/local/sae/python/lib/python2.7/dumbdbm.py", line 246, in open
    return _Database(file, mode)
  File "/usr/local/sae/python/lib/python2.7/dumbdbm.py", line 71, in __init__
    with _open(self._datfile, 'w') as f:
IOError: [Errno 13] Permission denied: '/data1/www/htdocs/783/booksearcher/1/werobot_session.dat'

  需要进一步对robot.py做出下述更改:

from werobot.session.saekvstorage import SaeKVDBStorage
session_storage = SaeKVDBStorage()
robot = werobot.WeRoBot(token="your_token", enable_session=True,
                        session_storage=session_storage)

  此时再访问sae应用网址

  

  此时公众号对任何输入都会返回Hello World!

  太好了,Hello World 部署完成,下面开始愉快的玩耍吧!

转载于:https://www.cnblogs.com/zhoudayang/p/5254650.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值