[英]CKAN distribution not found error while trying to serve CKAN from apache
我正在尝试为ckan 2.7配置datapusher,并且作为前提条件,我已经安装了数据存储和apache http服务器。
apache httpd版本:安装了Apache / 2.4.25(Unix)mod_wsgi软件包4.5.15 conf文件的权限如ckan文档http://docs.ckan.org/en/latest/maintaining/installing/deployment中所指定.html
ckan_default.conf的内容是
WSGIScriptAlias / /etc/ckan/default/apache.wsgi
WSGIPassAuthorization On
WSGIDaemonProcess ckan_default display-name=ckan_default processes=2 threads=15
WSGIProcessGroup ckan_default
ErrorLog /var/log/apache2/ckan_default.error.log
CustomLog /var/log/apache2/ckan_default.custom.log combined
apache.wsgi文件的内容 :
import os
ckan_home = os.environ.get('CKAN_HOME', '/usr/lib/ckan/default')
activate_this = os.path.join(ckan_home, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
from paste.deploy import loadapp
config_filepath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'production.ini')
from paste.script.util.logging_config import fileConfig
fileConfig(config_filepath)
application = loadapp('config:%s' % config_filepath)
当我启动apache httpd服务器时,我在日志中看到以下错误 。
[Tue May 02 17:39:23.953718 2017] [wsgi:error] [pid 24744:tid 140135528146688] mod_wsgi (pid=24744): Target WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python module.
[Tue May 02 17:39:23.953836 2017] [wsgi:error] [pid 24744:tid 140135528146688] mod_wsgi (pid=24744): Exception occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
[Tue May 02 17:39:23.953875 2017] [wsgi:error] [pid 24744:tid 140135528146688] Traceback (most recent call last):
[Tue May 02 17:39:23.953912 2017] [wsgi:error] [pid 24744:tid 140135528146688] File "/etc/ckan/default/apache.wsgi", line 10, in <module>
[Tue May 02 17:39:23.954043 2017] [wsgi:error] [pid 24744:tid 140135528146688] application = loadapp('config:%s' % config_filepath)
[Tue May 02 17:39:23.954067 2017] [wsgi:error] [pid 24744:tid 140135528146688] File "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
[Tue May 02 17:39:23.955927 2017] [wsgi:error] [pid 24744:tid 140135528146688] DistributionNotFound: The 'ckan' distribution was not found and is required by the application
谁能帮我解决这个问题? 提前致谢
PS:使用粘贴服务时,CKAN站点加载正常
谢谢Graham Dumpleton。该链接有所帮助。 问题是由于安装了不同版本的python和虚拟环境路径所致。 我添加并设置了适当的虚拟环境的路径。
步骤1)激活虚拟环境
步骤2)执行以下命令以了解虚拟环境的路径
python -c 'import sys; print(sys.prefix)'
步骤3)在ckan_default.conf文件中添加以下行(在虚拟主机之前)
WSGIPythonHome <path you got in step 2>
步骤4)重新启动apache
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.