简体   繁体   English

Mod_wsgi挂架(ckan)安装不起作用

[英]Mod_wsgi pylons (ckan) installation not working

I am setting up CKAN, a pylons application according to these instructions: http://packages.python.org/ckan/deployment.html 我正在根据以下说明设置CKAN(一种塔应用程序): http ://packages.python.org/ckan/deployment.html

But when I point to the server (no DNS setup yet) using IP or hostname, I only see apache's greeting page, sugesting the ckan app is not being loaded. 但是,当我使用IP或主机名指向服务器(尚无DNS设置)时,我仅看到apache的问候页面,这提示未加载ckan应用。

here is my mod_wsgi script: 这是我的mod_wsgi脚本:

import os
instance_dir = '/home/flavio/var/srvc/ckan.emap.fgv.br'
config_file = 'ckan.emap.fgv.br.ini'
pyenv_bin_dir = os.path.join(instance_dir, 'pyenv', 'bin')
activate_this = os.path.join(pyenv_bin_dir, 'activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
from paste.deploy import loadapp
config_filepath = os.path.join(instance_dir, config_file)
from paste.script.util.logging_config import fileConfig
fileConfig(config_filepath)
application = loadapp('config:%s' % config_filepath)

here is my virtual host configuration: 这是我的虚拟主机配置:

<VirtualHost *:80>

ServerName dck093

ServerAlias dck093

WSGIScriptAlias / /home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/bin/ckan.emap.fgv.br.py
# pass authorization info on (needed for rest api)
WSGIPassAuthorization On

ErrorLog /var/log/apache2/ckan.emap.fgv.br.error.log
CustomLog /var/log/apache2/ckan.emap.fgv.br.custom.log combined
<Directory /home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/bin>
    Order deny,allow
    Allow from all
</Directory>
</VirtualHost>

I try to disable the 000-default site (with a2dissite), but that dind't help.After doing this I get an Internal server error page. 我尝试禁用000默认站点(使用a2dissite),但这没有帮助。完成此操作后,我得到一个内部服务器错误页面。 After a fixing some permissions I managed to get this Pylons error log: 解决了一些权限后,我设法获得了此Pylons错误日志:

sudo tail /var/log/apache2/ckan.emap.fgv.br.error.log 
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]     app_iter = self.application(environ, start_response)
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]   File "/usr/lib/pymodules/python2.6/repoze/who/middleware.py", line 107, in __call__
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]     app_iter = app(environ, wrapper.wrap_start_response)
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]   File "/home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/lib/python2.6/site-packages/pylons/middleware.py", line 201, in __call__
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]     self.app, environ, catch_exc_info=True)
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]   File "/home/flavio/var/srvc/ckan.emap.fgv.br/pyenv/lib/python2.6/site-packages/pylons/util.py", line 94, in call_wsgi_application
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]     app_iter = application(environ, start_response)
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]   File "/usr/lib/pymodules/python2.6/weberror/evalexception.py", line 226, in __call__
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110]     "The EvalException middleware is not usable in a "
[Wed Mar 30 12:38:32 2011] [error] [client 10.250.48.110] AssertionError: The EvalException middleware is not usable in a multi-process environment

Can anyone point out what am I missing? 谁能指出我在想什么?

Since you're deploying on apache, ensure that you are not in interactive debug mode - which uses EvalException. 由于您是在apache上进行部署,因此请确保您未处于交互式调试模式-该模式使用EvalException。 In your Pylons config file (ckan.emap.fgv.br.ini) ensure you have this: 在您的Pylons配置文件(ckan.emap.fgv.br.ini)中,确保具有以下内容:

[app:main]
set debug = false

Your first problem is that you cannot use name based virtual hosts in Apache without having a hostname in DNS or local /etc/hosts which resolves to the IP of the server Apache is running on. 您的第一个问题是,如果没有DNS或本地/ etc / hosts中解析为运行Apache服务器的IP的主机名,则无法在Apache中使用基于名称的虚拟主机。

The second problem is because EvalException cannot be used in a multi process server configuration. 第二个问题是因为EvalException不能在多进程服务器配置中使用。 Read: 读:

http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Browser_Based_Debugger http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Browser_Based_Debugger

Either disable EvalException or configure mod_wsgi such that you are using daemon mode with 'default' of a single process (don't use processes=1). 禁用EvalException或配置mod_wsgi,以使您使用带有单个进程“默认”的守护程序模式(不要使用进程= 1)。

For background on various process/thread configurations possible for Apache/mod_wsgi read: 有关Apache / mod_wsgi可能的各种进程/线程配置的背景知识,请阅读:

http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading http://code.google.com/p/modwsgi/wiki/ProcessesAndThreading

You want to use one whereby 'wsgi.multiprocess' is False. 您想使用一种方法,其中“ wsgi.multiprocess”为False。

不是“粘贴”环境方面的专家,但不应是:

from paste.deploy.loadwsgi import loadapp

I agree that in production debug should be disabled, but I would really like to see stacktraces of exceptions. 我同意应该在生产调试中禁用调试,但是我真的很想看到异常的堆栈跟踪。

Right now if I get 500 Server error inside CKAN (nice CKAN page with error info is shown) in logs I can find only error description with no stacktrace: 现在,如果我在日志中的CKAN中看到500服务器错误(显示了带有错误信息的CKAN页面),我只能找到没有堆栈跟踪的错误描述:

[Thu Feb 12 17:04:55.037785 2015] [:error] [pid 15293:tid 139979468994304] [remote 89.71.231.138:5513] Error - <type 'exceptions.TypeError'>: 'NoneType' object is not iterable

Is there a way to enable full stacktrace with debug = false. 有没有一种方法可以使用debug = false启用完整的stacktrace。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM