UWSGI配置文件---ini和xml示例
2014-10-10 17:57
211 查看
一 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] |
是 wsgi app入口函数
相关文章推荐
- UWSGI配置文件---ini和xml示例
- UWSGI配置文件---ini和xml示例
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- 读取INI配置文件GetProfileString和GetPrivateProfileString参数说明和示例
- 应用程序——INI和XML配置文件
- 应用程序——INI和XML配置文件
- PHP读取4种配置文件(php,ini,yaml,xml)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- WinMoblie 利用EVC读写INI,XML配置文件
- 一个将配置文件转换成xml的示例程序
- PHP读取4种配置文件(php,ini,yaml,xml)
- 配置文件 INI 与 XML
- (转)ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- 用java读写ini配置文件的原因以及实现 示例
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- 认识配置设置文件(INI与XML)
- ASP.NET 2.0 读取配置文件[INI](示例代码下载)
- 读取INI配置文件GetProfileString和GetPrivateProfileString参数说明和示例
- INI配置文件的替代品-XML配置文件的操作
- VC使用tinyxml读写INI,cfg,XML配置文件