2017-05-03 98 views
0

我正在嘗試爲ckan 2.7配置datapusher,並且作爲先決條件我已經安裝了數據存儲和Apache HTTP服務器。嘗試從apache服務CKAN時發現CKAN分配錯誤

apache httpd的版本:阿帕奇/ 2.4.25(UNIX) mod_wsgi的軟件包安裝4.5.15 的權限被作爲CKAN文檔中ckan_default.confhttp://docs.ckan.org/en/latest/maintaining/installing/deployment.html

內容中指定的文件CONF是 apache.wsgi文件

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 

內容:

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網站荷載作用下貼服

+0

嘗試使用優選的機制用於使用mod_wsgi設置Python虛擬環境。請參閱http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html –

回答

1

罰款時,謝謝格雷厄姆Dumpleton.The鏈接幫助。 問題是由於安裝了不同版本的pythons和虛擬環境路徑。 我添加並設置了合適的虛擬環境的路徑。

步驟1)激活所述虛擬環境

步驟2)執行以下命令知道虛擬ENV

python -c 'import sys; print(sys.prefix)' 

步驟3)添加在ckan_default.conf文件中的下面行的路徑(前虛擬主機)

WSGIPythonHome <path you got in step 2> 

步驟4)再起動的apache