2012-03-24 34 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