Python RESTful Service(1)Twisted Version Upgrade
Check Python version and Pip Version
>python -V
Python 2.7.13
>pip -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
Make sure pip is the latest
>pip install -U setuptools
>pip install -U pip
Install twisted on my command line tool environment
Try to fetch the latest version right now.
>wget https://twistedmatrix.com/Releases/Twisted/17.1/Twisted-17.1.0.tar.bz2
Unzip that and move to the working directory
Install from the source
>python setup.py install Or >pip install Twisted
Verify the installation
>>> import twisted
>>> print twisted.version
[Twisted, version 17.1.0]
I have a sample project called sillycat-prest. And there is command to run that
>python restapi/com/sillycat/prestapi/RestAPI.py
But it seems a lot of work to do after we have the twisted.
Let’s try https://github.com/tornadoweb/tornado
References:
twisted
http://sillycat.iteye.com/blog/2243749
http://sillycat.iteye.com/blog/2243775
http://sillycat.iteye.com/blog/2244167
http://sillycat.iteye.com/blog/2244169
tornado
http://www.tornadoweb.org/en/stable/guide.html official document
https://segmentfault.com/a/1190000002703128
https://segmentfault.com/a/1190000002703321
https://segmentfault.com/a/1190000002705416
Check Python version and Pip Version
>python -V
Python 2.7.13
>pip -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (python 2.7)
Make sure pip is the latest
>pip install -U setuptools
>pip install -U pip
Install twisted on my command line tool environment
Try to fetch the latest version right now.
>wget https://twistedmatrix.com/Releases/Twisted/17.1/Twisted-17.1.0.tar.bz2
Unzip that and move to the working directory
Install from the source
>python setup.py install Or >pip install Twisted
Verify the installation
>>> import twisted
>>> print twisted.version
[Twisted, version 17.1.0]
I have a sample project called sillycat-prest. And there is command to run that
>python restapi/com/sillycat/prestapi/RestAPI.py
But it seems a lot of work to do after we have the twisted.
Let’s try https://github.com/tornadoweb/tornado
References:
twisted
http://sillycat.iteye.com/blog/2243749
http://sillycat.iteye.com/blog/2243775
http://sillycat.iteye.com/blog/2244167
http://sillycat.iteye.com/blog/2244169
tornado
http://www.tornadoweb.org/en/stable/guide.html official document
https://segmentfault.com/a/1190000002703128
https://segmentfault.com/a/1190000002703321
https://segmentfault.com/a/1190000002705416

本文介绍了如何使用 Python 的 Twisted 框架搭建 RESTful 服务,包括 Twisted 版本检查、安装配置过程及一个名为 sillycat-prest 的示例项目运行方法。此外还提到了 Tornado 作为另一种实现方案。
31万+

被折叠的 条评论
为什么被折叠?



