UWSGI配置文件---ini和xml示例

一   conf.ini文件:

[uwsgi]

http = $(HOSTNAME):9033

http-keepalive = 1

pythonpath = ../

module = service

master = 1

processes = 8

daemonize = logs/uwsgi.log

disable-logging = 1

buffer-size = 16384

harakiri = 5

pidfile = uwsgi.pid

stats = $(HOSTNAME):1733

运行:uwsgi --ini   conf.ini

二   conf.xml文件

<uwsgi>

  <!--

  <cluster>225.1.1.1:3333</cluster>

  <socket>192.168.60.*:3031</socket>

  <http>127.0.0.1:3031</http>

  -->

  <http>192.168.3.40:9033</http>

  <pythonpath>../</pythonpath>

  <module>service</module>

  <master>1</master>

  <processes>8</processes>

  <disable-logging />

  <daemonize>logs/uwsgi_bfdds.log</daemonize>

  <buffer-size>16384</buffer-size>

  <harakiri>30</harakiri>

  <pidfile>uwsgi_bfdds.pid</pidfile>

  <stats>192.168.3.40:1716</stats>

</uwsgi>

1  !--开头的是注释掉的。

2  接收的数据有两种方式,socket和http方式。分别写成:

<http>ip:port</http>

<socket>ip:por</socket>

3 <module>service</module>   是应用文件,例子中对应的文件service.py,用来处理请求

4   <pythonpath>../</pythonpath>  是应用文件所在的路径,也就是service.py所在路径。

三  应用内容

service.py脚本:

01 #!/usr/bin/python
02 import os
03 import sys

06 def
application(environ, start_response):
07     status
'200
OK'
08     output
'Hello
World!'
09     response_headers
= [(
'Content-type''text/plain'),
10                     ('Content-Length',
str(len(output)))]
11     start_response(status,
response_headers)
12     return [output]

application
是  wsgi app入口函数

上一篇:【转】eclipse -- the project was not built due to a resource exists with a different case...


下一篇:STC51系列单片机免掉电下载(热启动下载)