欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

tornado和telegraphy的helloworld

程序员文章站 2022-07-14 15:50:50
...
参考 http://www.tornadoweb.cn/

tar xvzf tornado-1.2.1.tar.gz
cd tornado-1.2.1
python setup.py build
sudo python setup.py install

helloworld
import tornado.ioloop
import tornado.web

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

application = tornado.web.Application([
    (r"/", MainHandler),
])

if __name__ == "__main__":
    application.listen(8888)
    tornado.ioloop.IOLoop.instance().start()

python hello.py
curl localhost:8888

websocket的
https://github.com/hiroakis/tornado-websocket-example
不好使.是因为需要国外使用google的js

-------------------------------------------------------------



尝试https://github.com/machinalis/telegraphy/
注意
https://github.com/machinalis/telegraphy/blob/master/developer_requirements.txt
这里说了依赖,依赖不对装不对呀
比如
pip install django_extensions==1.1.1

virtualenv telegraphy
. telegraphy/bin/activate
pip install zope.interface  
yum install bzip2-devel
cp /usr/lib64/python2.6/lib-dynload/bz2.so  /data/mysocket/python/telegraphy/telegraphy/lib/python2.7/
pip install  flake8==2.0
pip install django-nose==1.1
pip install ipdb==0.8
pip install mock==1.0.1
pip install django_extensions==1.1.1


virtualenv telegraphy
. telegraphy/bin/activate
pip install zope.interface  
yum install bzip2-devel
cp /usr/lib64/python2.6/lib-dynload/bz2.so /data/mysocket/python/Telegraphy/telegraphy/lib/python2.7/
pip install six
pip install six --upgrade
pip install telegraphy
pip install telegraphy --upgrade
pip install django_extensions
pip install pysqlite
pip install listenWS
(telegraphy)[root@VM_192_107_centos demo_project]# pwd
/data/mysocket/python/Telegraphy/git/telegraphy/demo_project
(telegraphy)[root@VM_192_107_centos demo_project]# python manage.py run_telegraph
相关标签: python