相關頁面:
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包進行查找
html
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 :
python
/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