我一直在尝试在 windows 中的 mod_wsgi 下设置金字塔。我的应用程序是使用命令创建的简单脚手架
..\Scripts\pcreate -s starter it
我的 httpd.conf 文件有以下指令
LoadModule wsgi_module modules/mod_wsgi-win32-ap22py27-3.3.so
WSGIScriptAlias /x "C:/Documents and Settings/Administrator.TRANSGLOBAL/Desktop/env/pyramid.wsgi"
<Directory "C:/Documents and Settings/Administrator.TRANSGLOBAL/Desktop/env">
Order allow,deny
Allow from all
</Directory>
所以我所有的应用程序代码都在它的文件夹中。mod_wsgi.so 文件被加载到 apache 中,下面的示例代码在 pyramid.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]
但是,当我更改 pyramid.wsgi 代码以指向名为“it”的金字塔应用程序时
from pyramid.paster import get_app
import os
import sys
application = get_app('C:\Documents and Settings\Administrator.TRANSGLOBAL\Desktop\env\it\development.ini', 'main')
Apache 日志产生以下错误
File "C:/Documents and Settings/Administrator.TRANSGLOBAL/Desktop/env/pyramid.wsgi", line 11, in <module>
application = get_app('C:\\Documents and Settings\\Administrator.TRANSGLOBAL\\Desktop\\env\\it\\development.ini', 'main')
File "C:\\Python27\\lib\\site-packages\\pyramid-1.4-py2.7.egg\\pyramid\\paster.py", line 31, in get_app
app = loadapp(config_name, name=section, relative_to=here_dir, **kw)
raise DistributionNotFound(req) # XXX put more info here
DistributionNotFound: it