UPDATE: Figured it out. I was loading the config options into production.ini, then running config.ini. DUH!
I'm setting up an existing project in Pylons and trying to tell it about my local configuration options. I've run
paster make-config my_app production.ini
and edited the production.ini
file to include the options I need, including an entry called solr.url
. However, if I then run
paster serve --reload config.ini
I get an error:
File "/lib/solrhelp.py", line 12, in solr_connection
solr_url = config['solr.url']
File "/lib/python2.6/site-packages/Paste-1.7.4-py2.6.egg/paste/registry.py", line 146, in __getitem__
return self._current_obj()[key]
KeyError: 'solr.url'
The file solrhelp.py has this:
from pylons import config
def solr_connection():
solr_url = config['solr.url']
So it looks as though pylons can't see the 'config' dictionary with the entry for solr.url.
Going to the python shell and doing
>>> from pylons import config
>>> print config
{'pylons.c_attach_args': True, 'buffet.template_options': {}, 'pylons.request_options': {'errors': 'replace', 'decode_param_names': False, 'charset': 'utf-8', 'language': 'en-us'}, 'pylons.paths': {'controllers': None, 'templates': [], 'static_files': None, 'root': None}, 'pylons.environ_config': {'session': 'beaker.session', 'cache': 'beaker.cache'}, 'pylons.db_engines': {}, 'pylons.strict_c': False, 'pylons.h': None, 'pylons.package': None, 'debug': False, 'pylons.g': None, 'buffet.template_engines': [], 'pylons.response_options': {'headers': {'Pragma': 'no-cache', 'Cache-Control': 'no-cache'}, 'errors': 'strict', 'charset': 'utf-8', 'content_type': 'text/html'}}
This doesn't seem to have any of the entries from production.ini.
How can I 'tell' Pylons about the entries in production.ini?