Tuesday, September 08, 2009

birdnest for twitter

说明: dreamhost share hosting不允许跑birdnest,会收到policy bot alert "user xxx running "python code.py xxx.xxx.xxx.xxx:xxxx " listening on port xxxx. Network daemons are against our Terms of Service.",以下权当折腾实录,并无可操作性

发现dreamhost上没办法直接跑twip,所以打起了birdnest的主意,虽然dh自带的python版本只有2.3.5,不过很容易就可以diy出birdnest需要的环境
birdnest, national stadium
  1. ssh连接上主机
  2. 安装python 2.6.2
    mkdir opt
    mkdir downloads
    cd downloads
    wget http://python.org/ftp/python/2.6.2/Python-2.6.2.tgz
    tar xvzf Python-2.6.2.tgz
    cd Python-2.6.2
    ./configure --prefix=$HOME/opt/ --enable-unicode=ucs4
    make
    make install
  3. 修改.bash_profile加入export PATH=$HOME/opt/bin/:$PATH
  4. 验证python版本
    source .bash_profile
    python --version
  5. 安装simplejson模块
    wget http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg
    sh setuptools-0.6c9-py2.6.egg
    easy_install simplejson
  6. checkout birdnest代码并试运行
    svn checkout http://birdnest.googlecode.com/svn/branches/stable
    python code.py 主机IP地址:端口号
    尝试用支持自定义api proxy的twitter客户端连接,地址设为
    http://IP地址:端口号/api
    验证ok后ctrl+c结束
  7. detach进程
    screen
    python code.py 主机IP地址:端口号
    ctrl+a ctrl+d
大功告成,至此birdnest成功运行在dreamhost主机上了

参见: 自建birdnest Twitter API proxy, Custom Python installation for Django on Dreamhost

0 comments:

Post a Comment