title: Retrieving current Pyramid ini settings from a python script
body: <p>I have a python script that serves as an additional wrapper around tummy's memcached python wrapper.  I have something like this:</p>
  
  <pre><code>class CacheIt(object):
    def __init__(self, host=&lt;hostname&gt;, port=11211, **kwargs):
      ...
  </code></pre>
  
  <p>I want to be able to retrieve the memcached hostname from my ini file, but I don't want to specify which file because it may be taken from development.ini or production.ini or test.ini.  I need the "finding" of the current ini file to be dynamic, meaning the application should know what the current ini file is and hence retrieve the hostname from the settings.</p>
  
  <p>I can't use thread locals get_current_request and in turn to retrieve the settings file because the return value is None at application startup time (I attach an instance of my class to a NewRequest event).</p>
  
  <p>This: </p>
  
  <pre><code>from paste.deploy.loadwsgi import appconfig
  config = appconfig('config:development.ini', 'myapp', relative_to='.')
  </code></pre>
  
  <p>Still, I need to know the path first before I can use this.  That means if I use this, I need to change the value of development.ini to production.ini everytime I deploy and to test.ini if I test.  Surely there has to be a better way to do this.</p>