Currently minimongo looks for configuration file in a number of special places: .config, .app_config etc.
This sure is a nice way of doing things, but why not add a shortcut for changing the defaults, so we don't force any specific locations. The idea is similar to what mongoengine offers:
from minimongo import configure
# a) manual configuration
# b) from a module
import app_config; configure(app_config)
What do you think?
Draft implementation: superbobry/minimongo@ef36b24
I like this idea, the only question I had from an app developer's perspective is something like:
"I only want to declare my host & port connection parameters once. Where do I put the call to configure()" Likely it will end up in the global scope in some imported file or, if you're using a web framework like I am, in some framework-specific file that's imported every time.
I think we can address this in the docs, but it's something to think about.
I've been reading some discussion on the Pyramid mailing list (http://groups.google.com/group/pylons-devel) and most of the users there are connecting to their DB with each request. Thought this was interesting, but since mod_wsgi gives long-lived processes, I actually like minimongo's current approach of connecting at process startup.
Personally, I'm not happy with the way configure() is implemented at the moment -- I'll take a look at Flask and see if we can borrow some of the ideas from it :)
Did this go anywhere? I'm using minimongo in a flask project and config's a bit of a pain
Not really, minimongo is not actively developed anymore ..