Python dj_database_url.config() Examples

The following are 4 code examples of dj_database_url.config(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module dj_database_url , or try the search function .
Example #1
Source File: settings.py    From connect with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def INSTALLED_APPS(self):
        return super().INSTALLED_APPS + (
            'django.contrib.sites',
            'django.contrib.flatpages',
            'django.contrib.humanize',
            'django_gravatar',
            'parsley',
            'connect',
            'connect.config',
            'connect.accounts',
            'connect.moderation',
            'connect.discover',
            'connect.connection',
        )

    # MIDDLEWARE 
Example #2
Source File: run_test.py    From django-pg-partitioning with MIT License 5 votes vote down vote up
def setup_django_environment():
    from django.conf import settings

    settings.configure(
        DEBUG_PROPAGATE_EXCEPTIONS=True,
        DATABASES={
            "default": dj_database_url.config(env="DATABASE_URL",
                                              default="postgres://test:test@localhost/test",
                                              conn_max_age=20)
        },
        SECRET_KEY="not very secret in tests",
        USE_I18N=True,
        USE_L10N=True,
        USE_TZ=True,
        TIME_ZONE="Asia/Shanghai",
        INSTALLED_APPS=(
            "pg_partitioning",
            "tests",
        ),
        LOGGING={
            "version": 1,
            "disable_existing_loggers": False,
            "formatters": {
                "standard": {
                    "format": "[%(asctime)s] %(message)s",
                    "datefmt": "%Y-%m-%d %H:%M:%S"
                }
            },
            "handlers": {
                "console": {
                    "level": "DEBUG",
                    "class": "logging.StreamHandler",
                    "formatter": "standard"
                }
            },
            "loggers": {
                "pg_partitioning.shortcuts": {
                    "handlers": ["console"],
                    "level": "DEBUG",
                    "propagate": False,
                },
                "pg_partitioning.patch.schema": {
                    "handlers": ["console"],
                    "level": "DEBUG",
                    "propagate": False,
                },
            },
        }
    )

    django.setup() 
Example #3
Source File: system_settings.py    From sal with Apache License 2.0 4 votes vote down vote up
def update_sal_logging_config(config):
    """Reset Sal logging to use config

    In most cases, call `get_sal_logging` first to get the existing
    config, update it, and then call this function.

    args:
        config (dict): Config to use, following the
            logging.config.dictConfig format.
    """
    global _SAL_LOGGING_CONFIG
    _SAL_LOGGING_CONFIG = config
    logging.config.dictConfig(_SAL_LOGGING_CONFIG) 
Example #4
Source File: system_settings.py    From sal with Apache License 2.0 4 votes vote down vote up
def get_sal_logging_config():
    """Return the current logging config for Sal

    returns:
        dict following the logging.config.dictConfig format.
    """
    return _SAL_LOGGING_CONFIG


# Zero out all of Django's logging decisions. It's easier this way.