在新浪sae上部署WeRoBot
生活随笔
收集整理的這篇文章主要介紹了
在新浪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 部署完成,下面開始愉快的玩耍吧!
總結
以上是生活随笔為你收集整理的在新浪sae上部署WeRoBot的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: QNX系统-关于delay函数与slee
- 下一篇: 图像配准:从SIFT到深度学习