相关页面:
http://webpy.org/install
http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
http://projects.unbit.it/uwsgi/wiki/Example
uwsgi的安装需要python-devel,可以使用yum search python-devel进行查找
没有的话可以到
http://www.rpmfind.net/进行相关rpm包进行查找
uwsgi安装:
wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz
tar zxvf uwsgi-latest.tar.gz
cd <dir>
make
生成可执行的二进制文件uwsgi
文件位置:
mkdir /home/uwsgi
mv uwsgi /home/uwsgi/
web.py安装:
http://webpy.org/install
python setup.py install 在解压的tar包中进行安装
简单运行文件:
vim test.py :
/usr/bin/python import web urls=('/(.*)','hello') app=web.application(urls,globals()) class hello: def GET(self,name): if not name: name='World' return 'Hello'+name+'!' application=app.wsgifunc()
if [ `whoami` != appuser ] then echo 'This script need appuser user' exit 1 fi if [ $# -ne 1 ]; then echo "Usage:$0 {stop|start|restart|reload}" exit -1 fi uwsgi_home='/home/uwsgi' service_home='/home/project/maintence.xxx.xxx.com' service_id='xxx' pid_file=$service_home/log/uwsgi.pid pid=$(cat $pid_file) function start(){ $uwsgi_home/uwsgi --xml $service_home/conf/uwsgi.conf:$service_id } function stop(){ $uwsgi_home/uwsgi --stop $pid_file sleep 3 ( netstat -tlunp | grep $pid | grep -q uwsgis ) 2> /dev/null if [ $? == 0 ];then kill -9 $pid sleep 1 fi } function reload(){ $uwsgi_home/uwsgi --reload $pid_file } case $1 in stop) stop ;; start) start ;; restart) stop start ;; reload) reload ;; esac