Mod_wsgi pylons (ckan) 安装不起作用

发布于 2024-10-28 04:59:36 字数 2889 浏览 2 评论 0 原文

我正在根据以下说明设置 CKAN,一个塔应用程序: http://packages.python.org/ckan/deployment.html

但是当我指向服务器时(没有DNS 设置尚未)使用 IP 或主机名,我只看到 apache 的问候页面,表明 ckan 应用程序未加载。

这是我的 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)

这是我的虚拟主机配置:

<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>

我尝试禁用 000-default 站点(使用 a2dissite),但这没有帮助。执行此操作后,我得到一个内部服务器错误页面。修复了一些权限后,我设法获取此 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

任何人都可以指出我缺少什么吗?

I am setting up CKAN, a pylons application according to these instructions:
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.

here is my mod_wsgi script:

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. After a fixing some permissions I managed to get this Pylons error log:

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

梦幻的心爱 2024-11-04 04:59:36

由于您在 apache 上进行部署,请确保您没有处于交互式调试模式 - 该模式使用 EvalException。在您的 Pylons 配置文件 (ckan.emap.fgv.br.ini) 中确保您有以下内容:

[app:main]
set debug = false

Since you're deploying on apache, ensure that you are not in interactive debug mode - which uses EvalException. In your Pylons config file (ckan.emap.fgv.br.ini) ensure you have this:

[app:main]
set debug = false
居里长安 2024-11-04 04:59:36

第一个问题是,如果 DNS 或本地 /etc/hosts 中没有主机名(解析为运行 Apache 的服务器的 IP),则无法在 Apache 中使用基于名称的虚拟主机。

第二个问题是因为 EvalException 不能在多进程服务器配置中使用。阅读:

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

禁用 EvalException 或配置 mod_wsgi,以便您使用带有“默认”单个进程的守护进程模式(不要使用进程=1)。

有关 Apache/mod_wsgi 可能的各种进程/线程配置的背景信息,请阅读:

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

您想要使用“wsgi.multiprocess”为 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.

The second problem is because EvalException cannot be used in a multi process server configuration. Read:

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).

For background on various process/thread configurations possible for Apache/mod_wsgi read:

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

You want to use one whereby 'wsgi.multiprocess' is False.

一世旳自豪 2024-11-04 04:59:36

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

from paste.deploy.loadwsgi import loadapp

Not an expert on the ''paste'' environment, but shouldn't be:

from paste.deploy.loadwsgi import loadapp
等数载,海棠开 2024-11-04 04:59:36

我同意在生产中应该禁用调试,但我真的很想看到异常的堆栈跟踪。

现在,如果我在日志中的 CKAN 内收到 500 服务器错误(显示了带有错误信息的不错的 CKAN 页面),我只能找到没有堆栈跟踪的错误描述:

[Thu Feb 12 17:04:55.037785 2015] [:error] [pid 15293:tid 139979468994304] [remote 89.71.231.138:5513] 错误 - : 'NoneType' 对象不可迭代

有没有办法通过 debug = 启用完整堆栈跟踪错误的。

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:

[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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文