[Web-SIG] Generic configuration
alex at grep.ro
Thu Mar 18 10:10:30 CET 2010
On 17 Mar 2010, at 13:47, Manlio Perillo wrote:
> Alex Morega ha scritto:
>> On 17 Mar 2010, at 0:24, Manlio Perillo wrote:
>>> Alex Morega ha scritto:
>>>> This is not really a WSGI question, it's more into general configuration, but I don't know of a better place to ask it.
>>> I use YAML with custom constructors:
>>> There is a middleware:
>>> that reads a list of configuration files to load from the WSGI environ
>>> (I set this in the Nginx mod_wsgi) configuration, and merge all the
>>> configuration in the WSGI environ.
>>> Using custom YAML constructors it is possible to do something like:
>> That's still configuring a piece of WSGI middleware or application. I'm thinking about something along these lines:
> Yes, since it works quite differently from other frameworks.
> Middleware are very easy to configure; in Nginx configuration file:
> wsgi_middleware wsgix.conf.middleware;
> The reason is that how you want to store configuration parameters should
> not hard written in the framework.
> Using YAML in my framework does not prevent using other methods like
> ConfigParser or Python modules.
>> factory = egg:PasteScript#wsgiutils
>> host = 127.0.0.1
>> port = 8000
>> app = my_site
> If you want this, isn't it more simple and generic to use YAML?
Yaml buys you flexibility at the cost of readability, which might be a good trade-off, but that's not the point. You still need a tool that reads the configuration file and does the actual setup.
Does the wsgix configuration loader allow for plugins, i.e. defining my own constructors? Is it documented?
I chose to base my example on Paster configuration because it already knows about egg entry points and explicitly pointing to factory functions.
More information about the Web-SIG