CKAN开发安装问题:AttributeError:'module'对象没有属性'css / main.debug.css'

时间:2012-11-20 19:39:13

标签: ckan

我已经完成了CKAN开发安装,并且在我的development.ini文件中运行了debug = true。在访问localhost:5000时,我得到一个错误,其回溯的结尾是错误:

AttributeError: 'module' object has no attribute 'css/main.debug.css'

由lib / helpers.py中的调用引起:

r = getattr(fanstatic_resources, resource)

知道我做错了什么以及我能做些什么来解决这个错误。

4 个答案:

答案 0 :(得分:14)

您需要从CKAN源代码中的less目录运行bin脚本来构建main.debug.css文件。有some documentation of this但它尚未与其他CKAN文档集成(即在任何地方都没有链接,我们有一张修复此问题的凭单)。

这适用于Ubuntu 12.04,你可能需要在执行此操作时激活virtualenv:

sudo apt-get install nodejs npm
npm install less nodewatch
./bin/less # Assuming you're in your ckan dir e.g. `~/pyenv/src/ckan`

现在重新启动paster serve development.ini命令,它应该可以正常工作。

一般来说,每当运行CKAN 2.0进行开发时,您应该:

  • 在您的ini文件中有debug = True
  • 始终在终端中运行./bin/less

答案 1 :(得分:5)

请注意apt-get install nodejsnodejs中安装node而不是/usr/bin,至少在Ubuntu 12.10中(我没有在其他发行版中签入)。由于ckan/bin/lessckan/node_modules/less/bin/lessc都在调用node,因此会引发错误。因此,要么在/ usr / bin中创建软链接,要么修改脚本(#!/usr/bin/env nodejs)。

答案 2 :(得分:4)

我在安装软件包时遇到了一些错误。以下是不耐烦的解决方案(根据official CKAN docs):

cp /usr/lib/ckan/default/src/ckan/ckan/public/base/css/main.css /usr/lib/ckan/default/src/ckan/ckan/public/base/css/main.debug.css

答案 3 :(得分:0)

我正在使用ubuntu 12.04并遇到一些问题

在听完Sean的答案并运行

后出现此错误

npm install less nodewatch

并收到此错误:

(default)root@ckan:/# npm install less nodewatch
npm http GET https://registry.npmjs.org/less
npm http GET https://registry.npmjs.org/nodewatch
npm ERR! Error: failed to fetch from registry: less
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "less" "nodewatch"
npm ERR! cwd /
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: less
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm not ok

找到了解释此问题的另一个thread并提供了执行

的解决方案
npm config set registry http://registry.npmjs.org/

然而,在运行上述命令后,我收到此错误:

(default)root@ckan:/# npm config set registry http://registry.npmjs.org/
(default)root@ckan:/# npm install less nodewatch
npm http GET http://registry.npmjs.org/less
npm http GET http://registry.npmjs.org/nodewatch
npm http 200 http://registry.npmjs.org/less
npm http GET http://registry.npmjs.org/less/-/less-1.6.3.tgz
npm http 200 http://registry.npmjs.org/nodewatch
npm http GET http://registry.npmjs.org/nodewatch/-/nodewatch-0.3.1.tgz
npm http 200 http://registry.npmjs.org/less/-/less-1.6.3.tgz
npm http 200 http://registry.npmjs.org/nodewatch/-/nodewatch-0.3.1.tgz
npm http GET http://registry.npmjs.org/mime
npm http GET http://registry.npmjs.org/request
npm http GET http://registry.npmjs.org/mkdirp
npm http GET http://registry.npmjs.org/clean-css
npm http GET http://registry.npmjs.org/source-map
npm http 200 http://registry.npmjs.org/request
npm http GET http://registry.npmjs.org/request/-/request-2.33.0.tgz
npm http 200 http://registry.npmjs.org/request/-/request-2.33.0.tgz
npm http 200 http://registry.npmjs.org/mime
npm http GET http://registry.npmjs.org/mime/-/mime-1.2.11.tgz
npm http 200 http://registry.npmjs.org/mkdirp
npm http 200 http://registry.npmjs.org/clean-css
npm http GET http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm WARN optional dependency failed, continuing clean-css@2.0.x
npm http 200 http://registry.npmjs.org/source-map
npm http 200 http://registry.npmjs.org/mime/-/mime-1.2.11.tgz
npm http GET http://registry.npmjs.org/source-map/-/source-map-0.1.3.tgz
npm http 200 http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 http://registry.npmjs.org/source-map/-/source-map-0.1.3.tgz
npm ERR! error installing less@1.6.3
npm ERR! error rolling back less@1.6.3 Error: UNKNOWN, unknown error '/node_modules/less'

npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: request@2.33.0
npm ERR! Required: ["node >= 0.8.0"]
npm ERR! Actual:   {"npm":"1.1.4","node":"0.6.12"}
npm ERR! 
npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "node" "/usr/bin/npm" "install" "less" "nodewatch"
npm ERR! cwd /
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm http GET http://registry.npmjs.org/requirejs/0.26.0
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /npm-debug.log
npm not ok

似乎版本不兼容或者这可能是node和node.js的问题?

干杯, 邵