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: >>>> Hello, >>>> >>>> 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: >>> http://hg.mperillo.ath.cx/wsgix/file/tip/wsgix/conf/loader.py >>> >>> There is a middleware: >>> http://hg.mperillo.ath.cx/wsgix/file/tip/wsgix/conf/middleware.py >>> 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: >>> http://hg.mperillo.ath.cx/wsgix/examples/file/tip/dbview/settings.yml >>> >> [...] >> >> 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. > >> ========================= >> [daemon] >> 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. Cheers, -- Alex _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com