[ckan-dev] Pylons config file loading problems

Eduardo Santos eduardo.edusantos at gmail.com
Fri Jun 29 21:11:08 UTC 2012


Hi everybody,

I'm trying to create a package containing a serie of scripts that will be
executed through a daemon. Everything seem to be working fine, but I need
to put some daemon parameters inside .ini pylons configuration file so i
can read it trhought a script.

However i don't know how to do it the right way. I've tried this:

from paste.deploy import appconfig
from pylons import config
from ckan.config.environment import load_environment
import os

# FIXME: Find correct path of configuration file
filename = os.path.abspath('/srv/ckan/py2env/src/ckan/')
#conf = appconfig('config:development.ini', relative_to=filename)
#load_environment(conf.global_conf, conf.local_conf)


But it's showing the following error:

ImportError: cannot import name getstatusoutput

if i just put this code:

from pylons import config

I get an empty configuration dictionay:

{'controllers': None, 'templates': [], 'static_files': None, 'root': None}

What's the right way to load Ckan configuration inside a script?

-- 
Eduardo Santos
Analista de Sistemas

http://www.eduardosan.com
http://twitter.com/eduardosan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20120629/5abe8475/attachment.html>


More information about the ckan-dev mailing list