Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit configuration #8

Open
superbobry opened this issue Mar 10, 2011 · 5 comments
Open

Explicit configuration #8

superbobry opened this issue Mar 10, 2011 · 5 comments

Comments

@superbobry
Copy link
Collaborator

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
configure(host="...", port="...")
# b) from a module
import app_config; configure(app_config)

What do you think?

@superbobry
Copy link
Collaborator Author

Draft implementation: superbobry/minimongo@ef36b24515cb3a37f4cb

@slacy
Copy link
Owner

slacy commented Mar 14, 2011

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.

@superbobry
Copy link
Collaborator Author

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 :)

@aidan
Copy link

aidan commented Dec 7, 2011

Did this go anywhere? I'm using minimongo in a flask project and config's a bit of a pain

@superbobry
Copy link
Collaborator Author

Not really, minimongo is not actively developed anymore ..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants