Mod_wsgi pylons (ckan) 安装不起作用
我正在根据以下说明设置 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
任何人都可以指出我缺少什么吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于您在 apache 上进行部署,请确保您没有处于交互式调试模式 - 该模式使用 EvalException。在您的 Pylons 配置文件 (ckan.emap.fgv.br.ini) 中确保您有以下内容:
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:
第一个问题是,如果 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.
不是“粘贴”环境的专家,但不应该:
Not an expert on the ''paste'' environment, but shouldn't be:
我同意在生产中应该禁用调试,但我真的很想看到异常的堆栈跟踪。
现在,如果我在日志中的 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.