On Wed, Sep 10, 2008 at 3:30 PM, Simon Willison <[EMAIL PROTECTED]> wrote: > > On Sep 10, 7:13 pm, "Justin Fagnani" <[EMAIL PROTECTED]> wrote: >> For application-wide db connections, I think it'd be much easier and >> more portable to choose the connection in settings.py rather than in a >> Model. > > That's a very interesting point, and one I hadn't considered. It makes > sense to allow people to over-ride the connection used by an > application they didn't write - for example, people may want to tell > Django that django.contrib.auth.User should live in a particular > database. Further-more, just allowing people to over-ride the > connection used for an existing application isn't enough - you need to > be able to over-ride the default get_connection method, since you > might want to shard Django's built in users (for example). > > This in definitely one of the use-cases we need to cover. > > I'm not sure of the best way to handle it though. The way I see it the > options are as follows: >
Would this perhaps be easier to do after the Apps-Refactor (#3591) lands? I'm not real familiar with that ticket, but if we're trying to set a connection on a app level - that seems like the easiest way to do it via settings. Something like: INSTALLED_APPS = ( app('django.contrib.auth', connection='my_user_db'), ... ) Not sure how that would work for over-riding the default get_connection method though. We'd probably still be referring to a callable by 'dotted.path.to.a.function' syntax. And it would apply to all models in an app, not just some. Just a thought. -- ---- Waylan Limberg [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---