nydus.contrib.django ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ from __future__ import absolute_import from nydus import conf from nydus.db.backends import BaseConnection from nydus.utils import import_string from django.conf import settings conf.configure(getattr(settings, 'NYDUS_CONFIG', {})) class DjangoDatabase(BaseConnection): def __init__(self, backend, name, host=None, port=None, test_name=None, user=None, password=None, options={}, **kwargs): """ Given an alias (which is defined in DATABASES), creates a new connection
nydus.contrib.django ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ from __future__ import absolute_import from nydus import conf from nydus.db.backends import BaseConnection from nydus.utils import import_string from django.conf import settings conf.configure(getattr(settings, 'NYDUS_CONFIG', {})) class DjangoDatabase(BaseConnection): def __init__(self, backend, name, host=None, port=None, test_name=None, user=None, password=None, options={}, **kwargs): """ Given an alias (which is defined in DATABASES), creates a new connection that proxies the original database engine. """ if isinstance(backend, basestring): backend = import_string(backend) self.backend = backend self.settings_dict = { 'HOST': host, 'PORT': port, 'NAME': name,
def configure(settings): connections = getattr(settings, 'NYDUS_CONNECTIONS', {}) conf.configure({'CONNECTIONS': connections})