[b]在apache下配置mod_wsgi[/b]
[list]
[*]Apache http Server: [url]http://httpd.apache.org/[/url]
[*]modwsgi: [url]http://code.google.com/p/modwsgi/[/url], [url]http://code.google.com/p/modwsgi/wiki/InstallationInstructions[/url]
[*]WSGI: [url]http://www.python.org/dev/peps/pep-0333/[/url]
[/list]
在安装好apache之后,还需要下载mod_wsgi.mod_wsgi是用于apache支持python wsgi协议的扩展,当前版本是3.3,有windows下支持不同python版本的二进制文件下载。
首先需要使apache httpd服务器加载wsgi_module扩展。将下载的mod_wsgi.so置于apache serverr安装目录的modules文件下,在httpd.conf文件中添加如下一行:
[code]
LoadModule wsgi_module modules/mod_wsgi.so
[/code]
使用WSGIScriptAlias指令来指定wsgi application的启动脚本。在httpd.conf中添加如下一行,这里使用默认的DocumentRoot:
[code]
WSGIScriptAlias /test "/path/to/docRoot/test.wsgi"
[/code]
在/test路径下访问测试程序,wsgi脚本文件为test.wsgi
重启apache sever之后,可以通过http://localhost/test来访问测试程序了。如果显示“Hello World!”则表明mod_wsgi安装成功。
[b]配置apache[/b]
...
[b]django在apache下的配置[/b]
[url]http://docs.djangoproject.com/en/1.1/howto/deployment/modwsgi/#howto-deployment-modwsgi[/url]
...
[list]
[*]Apache http Server: [url]http://httpd.apache.org/[/url]
[*]modwsgi: [url]http://code.google.com/p/modwsgi/[/url], [url]http://code.google.com/p/modwsgi/wiki/InstallationInstructions[/url]
[*]WSGI: [url]http://www.python.org/dev/peps/pep-0333/[/url]
[/list]
在安装好apache之后,还需要下载mod_wsgi.mod_wsgi是用于apache支持python wsgi协议的扩展,当前版本是3.3,有windows下支持不同python版本的二进制文件下载。
首先需要使apache httpd服务器加载wsgi_module扩展。将下载的mod_wsgi.so置于apache serverr安装目录的modules文件下,在httpd.conf文件中添加如下一行:
[code]
LoadModule wsgi_module modules/mod_wsgi.so
[/code]
使用WSGIScriptAlias指令来指定wsgi application的启动脚本。在httpd.conf中添加如下一行,这里使用默认的DocumentRoot:
[code]
WSGIScriptAlias /test "/path/to/docRoot/test.wsgi"
[/code]
在/test路径下访问测试程序,wsgi脚本文件为test.wsgi
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
重启apache sever之后,可以通过http://localhost/test来访问测试程序了。如果显示“Hello World!”则表明mod_wsgi安装成功。
[b]配置apache[/b]
...
[b]django在apache下的配置[/b]
[url]http://docs.djangoproject.com/en/1.1/howto/deployment/modwsgi/#howto-deployment-modwsgi[/url]
...