zoukankan      html  css  js  c++  java
  • 在新浪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 部署完成,下面开始愉快的玩耍吧!

  • 相关阅读:
    汇编 Hello Window [菜鸟]疑问
    得到指定进程所有窗口。显示 影藏 置顶。
    汇编,SendMessage和WM_SETTEXT
    C#: 字段和局部变量的作用域冲突
    C#: 给方法传递参数
    C#:类和结构
    C#: string 类型
    Copy files to a folder which need have Administrator approve and overwrite the existing same readonly files
    C#:构造函数
    C#:数组, 命名空间, Main()方法
  • 原文地址:https://www.cnblogs.com/zhoudayang/p/5254650.html
Copyright © 2011-2022 走看看