本文整理汇总了Python中environ.Env.bool方法的典型用法代码示例。如果您正苦于以下问题:Python Env.bool方法的具体用法?Python Env.bool怎么用?Python Env.bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类environ.Env
的用法示例。
在下文中一共展示了Env.bool方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Env
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
# -*- coding: utf-8 -*-
from multiprocessing import cpu_count
from environ import Env
env = Env()
bind = '0.0.0.0:80'
reload = env.bool('GUNICORN_RELOAD', default=False)
workers = env.int('GUNICORN_WORKERS', default=(cpu_count() * 2 + 1))
loglevel = env.str('GUNICORN_LOG_LEVEL', default='error')
errorlog = '-' # stderr
accesslog = '-' if env.bool('GUNICORN_ACCESS_LOG', default=False) else None
示例2: ImproperlyConfigured
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
from environ import Env
from inloop.accounts import constance as accounts_constance
from inloop.gitload import constance as gitload_constance
from inloop.solutions import constance as solutions_constance
if sys.getfilesystemencoding() != "utf-8":
raise ImproperlyConfigured("LANG must be a utf-8 locale")
PACKAGE_DIR = Path(__file__).resolve().parent
BASE_DIR = PACKAGE_DIR.parent
env = Env()
SECRET_KEY = env("SECRET_KEY")
DEBUG = env.bool("DEBUG", default=False)
ALLOWED_HOSTS = [host.strip() for host in env.list("ALLOWED_HOSTS")]
INTERNAL_IPS = [ip.strip() for ip in env.list("INTERNAL_IPS", default="")]
SITE_ID = 1
INSTALLED_APPS = [
"inloop.accounts",
"inloop.common",
"inloop.grading",
"inloop.solutions",
"inloop.tasks",
"inloop.testrunner",
"inloop.gitload",
"django.contrib.admin",
示例3: _
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# On Unix systems, a value of None will cause Django to use the same
# timezone as the operating system.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = env.str('TIME_ZONE', default='UTC')
# If you set this to True, Django will use timezone-aware datetimes.
USE_TZ = env.bool('USE_TZ', default=True)
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = "en"
# Supported languages
LANGUAGES = (
('en', _('English')),
)
# A boolean that turns on/off debug mode. When set to ``True``, stack traces
# are displayed for error pages. Should always be set to ``False`` in
# production. Best set to ``True`` in local_settings.py
DEBUG = env.bool('DEBUG', default=False)
示例4: join
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)
# load environment variables
Env.read_env(normpath(join(CONFIG_PATH, '.env')))
env = Env()
########## END PATH CONFIGURATION
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DEBUG', False)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END DEBUG CONFIGURATION
########## MANAGER CONFIGURATION
ADMIN_EMAIL = env.str('ADMIN_EMAIL', '[email protected]%s.com' % PROJECT_NAME)
ADMIN_NAME = env.str('ADMIN_NAME', ADMIN_EMAIL.split('@')[0])
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = (
(ADMIN_EMAIL, ADMIN_NAME),
)
示例5: Env
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
import os
from environ import Env
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
assert os.path.isfile(os.path.join(BASE_DIR, 'manage.py'))
env = Env()
env.read_env(os.path.join(BASE_DIR, '.env'))
DEBUG = env.bool('DEBUG', default=False)
SECRET_KEY = env.str('SECRET_KEY', default=('' if not DEBUG else 'xxx'))
DATABASES = {
'default': env.db_url(
default='psql://tallessa:[email protected]/tallessa',
),
}
CACHES = {'default': env.cache_url(default='locmemcache://')}
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
示例6: join
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
LOG_PATH = join(RESOURCES_PATH,'logs')
FIXTURES_DIR = 'fixtures'
FIXTURES_PATH = join(REPO_PATH, FIXTURES_DIR)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)
# load environment variables
Env.read_env(normpath(join(REPO_PATH, '.env')))
env = Env()
######### END PATH CONFIGURATION
########## OPEN_RICOSTRUZIONE CONFIGURATION
DEBUG = env.bool('DEBUG', False)
TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', False)
INSTANCE_TYPE = env.str('INSTANCE_TYPE', '')
ADMINS = (
('Guglielmo Celata', '[email protected]'),
)
MANAGERS = ADMINS
DATABASES = {
'default': env.db('DB_DEFAULT_URL', default='sqlite:///{0}'.format(normpath(join(RESOURCES_PATH, 'db', 'default.db')))),
}
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
示例7: join
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)
# load environment variables
Env.read_env(normpath(join(CONFIG_PATH, '.env')))
env = Env()
########## END PATH CONFIGURATION
########## START VOISIETEQUI CONFIGURATION
# Site status
EARLYBIRD_ENABLE = env.bool('EARLYBIRD_ENABLE', default=False)
RESULTS_DUMP = normpath(join(RESOURCES_PATH, 'results.csv'))
# PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
# REPO_ROOT = os.path.abspath(os.path.dirname(PROJECT_ROOT))
ELECTION_CODE = env('ELECTION_CODE', default='election')
ELECTION_NAME = env('ELECTION_NAME', default='Elezioni')
PARTY_LEADER = env('PARTY_LEADER', default='Segretario')
PARTY_COALITION = env('PARTY_COALITION', default='Coalizione')
PARTY_TERM = env('PARTY_TERM', default='Partito')
PARTY_TERM_PLURAL = env('PARTY_TERM_PLURAL', default='Partiti')
PARTY_TERM_GENDER = env('PARTY_TERM_GENDER', default='male')
OF_PARTY_TERM_PLURAL = env('OF_PARTY_TERM_PLURAL', default='dei partiti')
THE_PARTY_TERM_PLURAL = env('THE_PARTY_TERM_PLURAL', default='i partiti')
示例8: Env
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
import os
from environ import Env
env = Env()
HOME_DIR = env.str(
"HOME_DIR",
default=os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
)
env.read_env(os.path.join(HOME_DIR, ".env"))
DEBUG = env.bool("DEBUG", False)
SECRET_KEY = env.bool("SECRET_KEY", "Sehr lecker Wurst" if DEBUG else Env.NOTSET)
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["*"])
DATABASES = {
"default": env.db_url(default="sqlite:///%s" % os.path.join(HOME_DIR, "wurst.sqlite3"))
}
STATIC_ROOT = env.str("STATIC_ROOT", default=os.path.join(HOME_DIR, "static"))
MEDIA_ROOT = env.str("MEDIA_ROOT", default=os.path.join(HOME_DIR, "media"))
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'reversion',
'rest_framework',
'rest_framework.authtoken',
'wurst.core',
示例9: join
# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import bool [as 别名]
RESOURCE_DIR = 'resources'
RESOURCES_PATH = join(REPO_PATH, RESOURCE_DIR)
# Add our project to our pythonpath, this way we don't need to type our project
# name in our dotted import paths:
path.append(PROJECT_PATH)
# load environment variables
Env.read_env(normpath(join(CONFIG_PATH, '.env')))
env = Env()
########## END PATH CONFIGURATION
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = env.bool('DEBUG', False)
DEBUG_TOOLBAR = env.bool('DEBUG_TOOLBAR', DEBUG)
########## END DEBUG CONFIGURATION
########## MANAGER CONFIGURATION
ADMIN_EMAIL = env('ADMIN_EMAIL', default='[email protected]%s.com' % PROJECT_NAME)
ADMIN_NAME = env('ADMIN_NAME', default=ADMIN_EMAIL.split('@')[0])
# See: https://docs.djangoproject.com/en/dev/ref/settings/#admins
ADMINS = (
(ADMIN_EMAIL, ADMIN_NAME),
)
# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS