2012-03-24 65 views
1

運行WSGI應用程序爲了debugg我試圖部署到openshift一個bottle.py應用(與我懷疑的一個問題是連接到mod_wsgi的 - 這open question)我試圖運行的mod_wsgi在我的Linux站上。正如標題所述 - 我失敗了。悲慘的失敗與mod_wsgi的

我下載並安裝了mod_wsgi,根據mod_wsgi wiki中的說明編譯爲python2.6。

運行apache2ctl -MI證實mod_wsgi的(共享)是在結果列表中,所以我想我已經得到了部分權

我寫了一個APPNAME文件在/ etc/apache2的/網站,availble的包含:

運行後
<VirtualHost *:8051> #also tried with * or *:80 or myappname 
# ServerName 127.0.0.1:8051 #also tried to uncomment 
    ServerAlias wikimen #also tried without 

# WSGIDaemonProcess wikimen user=myusername group=myusername threads=5 #also tried to uncomment 
    WSGIScriptAlias//home/myusername/workspace/myapp/wsgi/application 
    DocumentRoot /home/myusername/workspace/myapp/wsgi 

    <Directory /home/myusername/workspace/myapp/wsgi> 

#  WSGIProcessGroup myapp 
#  WSGIApplicationGroup %{GLOBAL} 
     Order deny,allow 
     Allow from all 
    </Directory> 
</VirtualHost> 

和:

sudo a2ensite 

檢查,這是在啓用站點二相應地創建r和運行:

sudo service apacha2 reload 

當我去到瀏覽器,並嘗試: 本地主機:8051或本地主機/應用程序的名字/ routename或本地主機:8051/routename或本地主機:8051 /應用程序的名字或它們之間的任何其他組合,我只是得到(也改變本地主機127.0.0.1時):

unable to connect 

的WSGI處理文件(名爲 「應用程序」)包含:

#!/usr/bin/python 

import os 
here = os.path.dirname(os.path.abspath(__file__)) 


try: 

    os.environ['PYTHON_EGG_CACHE'] = os.path.join(os.environ['OPENSHIFT_APP_DIR'],'virtenv/lib/python2.6/site-packages') 

except: 
    os.environ['PYTHON_EGG_CACHE'] = os.path.join(here,'..','data/virtenv/lib/python2.6/site-packages') 

print ('python egg cache set to: %s' % os.environ['PYTHON_EGG_CACHE']) 
try: 

    virtualenv = os.path.join(os.environ['OPENSHIFT_APP_DIR'],"virtenv/bin/activate_this.py") 
except: 
    virtualenv = os.path.join(here,'..',"data/virtenv/bin/activate_this.py") 

print ('virtualenv is in:%s' % virtualenv) 
try: 
    execfile(virtualenv, dict(__file__=virtualenv)) 
    print ('executed') 

except IOError: 
    pass 

from myappname import application 

但正如我所說它的工作(也調用一些奇怪的bottle.py錯誤)在openshift服務器,所以我想這不是問題,我很樂意被駁斥

也許我應該提到的wsgi「應用程序」文件作爲其餘的應用程序是在一個virtualenv中的目錄

我不與Apache真正的好(我們的生產服務器使用切諾基反向代理和本地的python服務器,而不是mod_wsgi的),所以也許我失去了一些東西基本

基本瓶.py運行,如果我直接運行輸入wsgi句柄 我會很高興的任何幫助

使用:ubunto 11,apache2.2,當前的mod_wsgi版本,python 2.6(我也有python 2.7,但是根據openshift服務器,它運行在python2.6的virtualenv中)

tailing the apache2 error log不顯示任何有用的(也殺死它,並重新開始):

> [Sat Mar 24 15:45:10 2012] [notice] Apache/2.2.20 (Ubuntu) 
> PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 
> configured -- resuming normal operations [Sat Mar 24 21:19:24 2012] 
> [notice] caught SIGTERM, shutting down [Sat Mar 24 21:19:54 2012] 
> [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.6 with 
> Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 configured -- resuming normal 
> operations [Sat Mar 24 21:36:30 2012] [notice] Apache/2.2.20 (Ubuntu) 
> PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 
> configured -- resuming normal operations [Sat Mar 24 21:40:48 2012] 
> [notice] caught SIGTERM, shutting down [Sat Mar 24 21:41:18 2012] 
> [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.6 with 
> Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 configured -- resuming normal 
> operations [Sat Mar 24 23:47:11 2012] [notice] Apache/2.2.20 (Ubuntu) 
> PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 
> configured -- resuming normal operations [Sun Mar 25 22:20:22 2012] 
> [notice] Apache/2.2.20 (Ubuntu) PHP/5.3.6-13ubuntu3.6 with 
> Suhosin-Patch mod_wsgi/3.3 Python/2.6.7 configured -- resuming normal 
> operations [Sun Mar 25 22:34:12 2012] [notice] caught SIGTERM, 
> shutting down [Sun Mar 25 22:34:24 2012] [notice] Apache/2.2.20 
> (Ubuntu) PHP/5.3.6-13ubuntu3.6 with Suhosin-Patch mod_wsgi/3.3 
> Python/2.6.7 configured -- resuming normal operations 

回答

1

我你得到「無法接通」在瀏覽器中,然後自認倒黴mod_wsgi的,而是你的瀏覽器甚至不能連接到做服務器。用您在Apache錯誤日誌中找到的任何錯誤消息修改您的問題?由於配置文件錯誤,您的Apache甚至可能無法啓動。

+0

哇@格雷厄姆 - 杜姆普頓自己 - 我很榮幸。實際上在瀏覽器中嘗試使用localhost/index.html可以讓我獲得「它的效果!「消息,所以我猜apache正在運行 – alonisser 2012-03-25 20:24:58

+0

我剛剛編輯的問題與Apache錯誤日誌 - 沒有用我認爲 – alonisser 2012-03-25 20:38:18

+0

發現問題aargghh - 我不得不添加一個偵聽指令端口8051 – alonisser 2012-03-25 20:52:29