Python 在windows上设置mod_wsgi和pyramid

Python 在windows上设置mod_wsgi和pyramid,python,apache,mod-wsgi,pyramid,Python,Apache,Mod Wsgi,Pyramid,我一直在尝试在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/

我一直在尝试在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>
但是当我将pyramid.wsgi代码更改为指向名为“it”的pyramid应用程序时

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
文件“C:/Documents and Settings/Administrator.TRANSGLOBAL/Desktop/env/pyramid.wsgi”,第11行,在
application=get\u app('C:\\Documents and Settings\\Administrator.TRANSGLOBAL\\Desktop\\env\\it\\development.ini','main')
get_应用程序中的文件“C:\\Python27\\lib\\site packages\\pyramid-1.4-py2.7.egg\\pyramid\\paster.py”,第31行
app=loadapp(配置名称,名称=section,相对地址=here\u dir,**kw)
提升分配未找到(req)#XXX在此处输入更多信息
DistributionNotFound:它

经过大量实验,我发现我使用的所有windows设备(windows 7、windows 8和windows server 2003)都拒绝使用虚拟环境中的文件,并在c:/python27/Lib/sitepackages中查找it项目文件

解决方案是设置我的包的dist包

。\Scripts\python setup.py sdist

然后在dist文件夹中安装应用程序,就像其他应用程序一样。我的apache配置保持不变

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')
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