2013-02-13 70 views
0

我一直试图在windows下的mod_wsgi下设置金字塔。我的应用程序是用命令创建一个简单的支架在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代码指向我的金字塔的应用程序名为“它”

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 

回答

0

大量实验后,我来发现所有的窗户框(Windows 7中,Windows 8和Windows Server 2003中)我使用d拒绝使用虚拟ENV的文件和寻找IT项目文件:c:/ python27 /库/ sitepackages

溶液建立我的包的DIST包

..\Scripts\python setup.py sdist

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