当前位置: 首页>>代码示例>>Python>>正文


Python Env.list方法代码示例

本文整理汇总了Python中environ.Env.list方法的典型用法代码示例。如果您正苦于以下问题:Python Env.list方法的具体用法?Python Env.list怎么用?Python Env.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在environ.Env的用法示例。


在下文中一共展示了Env.list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import list [as 别名]
# If True, the django-modeltranslation will be added to the
# INSTALLED_APPS setting.
USE_MODELTRANSLATION = False


########################
# MAIN DJANGO SETTINGS #
########################

SECRET_KEY = env.str('SECRET_KEY', default='')
NEVERCACHE_KEY = env.str('NEVERCACHE_KEY', default='')

# 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
开发者ID:jsatt,项目名称:jsattcom-mezzanine,代码行数:32,代码来源:settings.py

示例2: ImproperlyConfigured

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import list [as 别名]
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",
    "django.contrib.auth",
开发者ID:st-tu-dresden,项目名称:inloop,代码行数:32,代码来源:settings.py

示例3: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import list [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',
开发者ID:japsu,项目名称:wurst,代码行数:33,代码来源:settings.py


注:本文中的environ.Env.list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。