uwsgi: command not found

問題描述:uwsgi: command not found

[root@CentOS6 home]# uwsgi --help
-bash: uwsgi: command not found

解決辦法:找到uwsgi執行位置,建立軟鏈接

[root@CentOS6 home]# find / -name uwsgi
/usr/local/python27/bin/uwsgi
[root@CentOS6 home]# ln -s /usr/local/python27/bin/uwsgi /usr/bin/uwsgi

軟連接起作用後:

[root@CentOS6 home]# uwsgi --help
Usage: /usr/local/python27/bin/uwsgi [options...]
    -s|--socket                             bind to the specified UNIX/TCP socket using default protocol
    -s|--uwsgi-socket                       bind to the specified UNIX/TCP socket using uwsgi protocol
    ...

測試uwsgi是否正常運行

創建test.py文件如下:

def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"]

運行方式一:
uwsgi --http-socket :8088 --wsgi-file test.py
或 uwsgi --http :8001 --wsgi-file test.py
運行方式二:運行uwsgi.ini配置文件,uwsgi --ini ./uwsgi.ini,配置文件內容如下:

[uwsgi]
http-socket= :8088
chdir=/home/project
wsgi-file=test.py

訪問均可得:
在這裏插入圖片描述

uwsgi出現invalid request block size: 21573 (max 4096)…skip解決辦法

buffer-size
uwsgi內部解析的數據包大小,默認4k。
如果準備接收大請求,你可以增長到64k。
允許uwsgi接收到32k,更大的會被丟棄。
uwsgi.ini配置如下:

[uwsgi]
socket = 127.0.0.1:8088
chdir = /home/project
wsgi-file = test.py
master = true
processes = 1
buffer-size = 65536

或者給uwsgi啓動命令家參數:uwsgi -b 8192

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章