nginx部署web.py項目

= =測試環境直接就python index.py就好啦python

生產環境nginx + web.py + uwsginginx

安裝uwsgi...web

pip install uwsgiapp

首先把本身的代碼小改一下。。。測試

app = web.application(urls, globals())
application = app.wsgifunc()

就是加一句appcation = app.wsgifunc()url

 

而後再nginx配置個serverspa

server 
{
    listen 80;
    server_name 127.0.0.1;
    location /{
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:9090;

        uwsgi_param UWSGI_CHDIR /home/notice/web/;
    }

    location /static {
        alias /home/notice/web/static;
        autoindex on;
    }


}

很簡單,就是使用uwsig來作個代理之類的。。代理

/static  是靜態文件的映射code

而後重啓nginxserver

啓動uswgi

uwsgi -s 127.0.0.1:9090 -w index

相關文章
相關標籤/搜索