[py-dev] new resource API nearing completion including impl
Carl Meyer
carl at oddbird.net
Mon Aug 6 05:47:08 CEST 2012
Hi all,
On 08/02/2012 01:36 AM, holger krekel wrote:
> As to Django, maybe Carl can help by stating his guess if it's possible at all
> to successively instantiate Django with different backends within
> one process.
I've just returned from vacation and haven't fully followed the thread,
but I'd expect this to be difficult and fragile; the Django ORM
currently instantiates a number of objects based on your settings
(including the DATABASES setting) at import-time of the django.db
module, so you'd either need to manually reinstantiate and monkey-patch
those objects (e.g. django.db.connections), or reload django.db.
It might also be possible to achieve this via Django's
multiple-databases support somehow, though I'd expect again you'd need
to do some monkey-patching of django.db.connections["default"], and
there might well be hidden gotchas.
Carl
More information about the Pytest-dev
mailing list