Archive

Posts Tagged ‘django’

Ajax long polling with Django

October 7, 2010 Leave a comment

This post is to document the steps I took to make the ajax long polling example on http://blog.gevent.org/2009/10/10/simpler-long-polling-with-django-and-gevent/ work on Centos 5.5 (32bit):
0) Prepare
a. add additional repositories
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.1-1.el5.rf.*.rpm
# if the above step returns "rpmforge-release-0.5.1-1.el5.rf.i386.rpm: (sha1) dsa sha1 md5 gpg OK", continue
rpm -i rpmforge-release-0.5.1-1.el5.rf.*.rpm

[ credit: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm ]

b. install python-setuptools
yum install python-setuptools

1) Install greenlet
cd /tmp
wget http://pypi.python.org/packages/source/g/greenlet/greenlet-0.3.1.tar.gz#md5=8d75d7f3f659e915e286e1b0fa0e1c4d
tar xzf greenlet-0.3.1.tar.gz
cd greenlet-0.3.1
python setup.py install

2) Install Cython
wget http://www.cython.org/release/Cython-0.13.tar.gz
tar xzf Cython-0.13.tar.gz
cd Cython-0.13
python setup.py install

3) Install mercurial (which provides the tool hg to download gevent in the next step)
yum install mercurial

4) Install gevent and the webchat example
cd /tmp
hg clone http://bitbucket.org/denis/gevent
cd gevent
python setup.py install

5) Install Django
cd /tmp
wget http://www.djangoproject.com/download/1.2.3/tarball/
tar xzvf Django-1.2.3.tar.gz
cd Django-1.2.3
sudo python setup.py install

6) Install python-uuid, python-simplejson and python-sqlite2
easy_insall uuid
yum install python-simplejson
yum install python-sqlite2

[ the first command in this step can be substituted with yum install python-uuid I believe, though I didn’t try it because easy_install uuid works ]

7) Run the webchat example
cd /tmp/gevent/examples/webchat
python run.py

Advertisements
Categories: django, howto Tags: ,