2013-02-13 49 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配置保持不變。