Paste.deploy - Is it possible to pass 2 config files?

274 views Asked by At

I'm in the context of a pyramid app, which has a wsgi.py file that looks like this:

import os.path
import traceback
from paste.deploy import loadapp
from pyramid.paster import setup_logging
DEFAULT_CONF_FILE = "/etc/myconf.conf"

config = DEFAULT_CONF_FILE

try:
  import mod_wsgi
  process_group = mod_wsgi.process_group
  config = os.path.join('/etc', process_group + '.conf')
except Exception as e:
  print "There was an exception when trying to determine the configuration file from mod_wsgi: %s" % str(e)
  traceback.print_exc()
if not os.path.isfile(config):
  config = DEFAULT_CONF_FILE

setup_logging(config)
application = loadapp('config:' + config)

What I want to do is to be able to use 2 configuration files.

My first guess is just to write a new file where I put the content of the 2 config files in it, but it seems... ugly.

Reading the doc of paste.deploy, I found nothing that seems to be close to what I'd want to do, except maybe for the factories. Thing is, I'm not sure what they're for and I want to do something like:

app_factory('myconf1.conf', 'myconf2.conf')

and not:

app_factory('myconf1.conf', some_option='value', some_other_option='other value',...)

Am I missing something or is there just no way to use 2 conf files with paste.deploy and I'll just 'concatenate' the 2 files?

Thanks.

EDIT:

I've read this question which could look like what I want to do, but not quite (I shouldn't modify my conf file). I don't want to override a section in the base file. I really just want a concatenation of those two files without having to do it beforehand.

0

There are 0 answers