本文整理汇总了Python中dj_database_url.config方法的典型用法代码示例。如果您正苦于以下问题:Python dj_database_url.config方法的具体用法?Python dj_database_url.config怎么用?Python dj_database_url.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dj_database_url
的用法示例。
在下文中一共展示了dj_database_url.config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: INSTALLED_APPS
# 需要导入模块: import dj_database_url [as 别名]
# 或者: from dj_database_url import config [as 别名]
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
示例2: update_sal_logging_config
# 需要导入模块: import dj_database_url [as 别名]
# 或者: from dj_database_url import config [as 别名]
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)
示例3: get_sal_logging_config
# 需要导入模块: import dj_database_url [as 别名]
# 或者: from dj_database_url import config [as 别名]
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.
示例4: setup_django_environment
# 需要导入模块: import dj_database_url [as 别名]
# 或者: from dj_database_url import config [as 别名]
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()