Exemple #1
0
    def test_default_settings(self):
        # pylint: disable=invalid-name
        APP_NAME = 'django_app'
        DEBUG = True

        settings_dict = dict(default_settings.init_settings(app_name=APP_NAME, debug=DEBUG))

        self.assertEqual(settings_dict['TEMPLATE_DEBUG'], DEBUG)
        self.assertEqual(settings_dict['TIME_ZONE'], None)
        self.assertIn(APP_NAME, settings_dict['APP_ROOT_DIR'])
Exemple #2
0
    def test_default_settings(self):
        # pylint: disable=C0103
        APP_NAME = 'django_app'
        DEBUG = True

        settings_dict = dict(default_settings.init_settings(APP_NAME=APP_NAME, DEBUG=DEBUG))

        self.assertEqual(settings_dict['TEMPLATE_DEBUG'], DEBUG)
        self.assertEqual(settings_dict['TIME_ZONE'], None)
        self.assertIn(APP_NAME, settings_dict['APP_ROOT_DIR'])
Exemple #3
0
    'django.middleware.common.CommonMiddleware',
    'django_short_urls.middleware.ServiceUnavailableMiddleware',
)

ROOT_URLCONF = 'django_short_urls.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'django_short_urls.wsgi.application'

AUTHENTICATION_BACKENDS = ('mongoengine.django.auth.MongoEngineBackend', )

#########################
# Default configuration #
#########################

for (key, value) in init_settings(APP_NAME=APP_NAME, DEBUG=DEBUG):
    if key not in globals():
        globals()[key] = value

# Databases

import mongoengine

try:
    # pylint: disable=W0142
    mongoengine.connect(**MONGOENGINE)

    SERVICE_UNAVAILABLE = False
except mongoengine.connection.ConnectionError, err:  # pragma: no cover
    logging.error('MongoEngine ConnectionError: %s', err)
    SERVICE_UNAVAILABLE = True
from __future__ import unicode_literals

import logging

import mongoengine

from django_app.default_settings import init_settings


APP_NAME = 'django_app'

DEBUG = True

SECRET_KEY = 'Foobar'

#########################
# Default configuration #
#########################

globals().update(init_settings(app_name=APP_NAME, debug=DEBUG))


# Databases

try:
    mongoengine.connect(tz_aware=USE_TZ, **MONGOENGINE)  # pylint: disable=undefined-variable
except mongoengine.connection.MongoEngineConnectionError, err:  # pragma: no cover
    logging.error('MongoEngineConnectionError: %s', err)

INSTALLED_APPS = (APP_NAME,)
)

ROOT_URLCONF = 'django_short_urls.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'django_short_urls.wsgi.application'

AUTHENTICATION_BACKENDS = (
    'mongoengine.django.auth.MongoEngineBackend',
)

#########################
# Default configuration #
#########################

for (key, value) in init_settings(APP_NAME=APP_NAME, DEBUG=DEBUG):
    if key not in globals():
        globals()[key] = value


# Databases

import mongoengine

try:
    # pylint: disable=W0142
    mongoengine.connect(**MONGOENGINE)

    SERVICE_UNAVAILABLE = False
except mongoengine.connection.ConnectionError, err:  # pragma: no cover
    logging.error('MongoEngine ConnectionError: %s', err)