Beispiel #1
0
    def test_sqlite_memory(self):
        conf = url.database_conf_from_url('sqlite://')

        self.assertDictEqual(
            conf, {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': '',
                'USER': None,
                'HOST': None,
                'PORT': None,
                'PARAMS': {},
                'SCHEMA': None,
                'PASSWORD': None,
            })
Beispiel #2
0
    def test_db_url_with_slashes(self):
        name = quote('/var/db/tweets.sqlite', safe='')
        conf = url.database_conf_from_url('sqlite3:///{0}'.format(name))

        self.assertDictEqual(
            conf, {
                'ENGINE': 'django.db.backends.sqlite3',
                'NAME': '/var/db/tweets.sqlite',
                'USER': None,
                'HOST': None,
                'PORT': None,
                'PARAMS': {},
                'SCHEMA': None,
                'PASSWORD': None,
            })
Beispiel #3
0
 def test_register(self):
     url.register_engine('abc', 'a.b.c')
     conf = url.database_conf_from_url('abc://5monkeys.se')
     self.maxDiff = None
     self.assertDictEqual(
         conf, {
             'ENGINE': 'a.b.c',
             'HOST': '5monkeys.se',
             'NAME': '',
             'PARAMS': {},
             'PASSWORD': None,
             'PORT': None,
             'SCHEMA': None,
             'USER': None,
         })
Beispiel #4
0
    def test_db_url(self):
        conf = url.database_conf_from_url(
            'pgsql://*****:*****@5monkeys.se:4242/tweets/tweetschema'
            '?hello=world')

        self.assertDictEqual(
            conf, {
                'ENGINE': 'django.db.backends.postgresql_psycopg2',
                'HOST': '5monkeys.se',
                'NAME': 'tweets',
                'PARAMS': {
                    'hello': 'world'
                },
                'PASSWORD': '******',
                'PORT': 4242,
                'SCHEMA': 'tweetschema',
                'USER': '******',
            })
Beispiel #5
0
            'propagate': False,
        },
        'sentry.errors': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
    },
}


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
from bananas.url import database_conf_from_url
default_db = 'sqlite3://{}'.format(os.path.join(BASE_DIR, 'db.sqlite3'))
db_config = database_conf_from_url(os.getenv('DJANGO_DB', default_db))

DATABASES = {
    'default': db_config
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True
Beispiel #6
0
            'propagate': False,
        },
        'sentry.errors': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
    },
}


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
from bananas.url import database_conf_from_url
default_db = 'sqlite3://{}'.format(os.path.join(BASE_DIR, 'db.sqlite3'))
db_config = database_conf_from_url(os.getenv('DJANGO_DB', default_db))

DATABASES = {
    'default': db_config
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True