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


Python Env.str方法代码示例

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


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

示例1: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]
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),
)

# See: https://docs.djangoproject.com/en/dev/ref/settings/#managers
MANAGERS = ADMINS

# See: https://docs.djangoproject.com/en/dev/ref/settings/#default-from-email
DEFAULT_FROM_EMAIL = env.str('DEFAULT_FROM_EMAIL', ADMIN_EMAIL)
########## END MANAGER CONFIGURATION

开发者ID:openpolis,项目名称:op-accesso,代码行数:31,代码来源:base.py

示例2: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [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
开发者ID:Baljan,项目名称:cafesys,代码行数:17,代码来源:gunicorn-conf.py

示例3: Env

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

示例4:

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]
# )

# Setting to turn on featured images for blog posts. Defaults to False.
#
# BLOG_USE_FEATURED_IMAGE = True

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

示例5: join

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]
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
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
开发者ID:DeppSRL,项目名称:open_ricostruzione,代码行数:33,代码来源:base.py

示例6: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]
import os

import babel
from environ import Env

env = Env()
DEBUG = env.bool('DEBUG', default=False)
SECRET_KEY = env.str('SECRET_KEY', default=('cfh' if DEBUG else Env.NOTSET))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
ALLOWED_HOSTS = ['*']

DATABASES = {
    'default': env.db_url(default='postgis://postgres:[email protected]:5432/cfh')
}

INSTALLED_APPS = list(filter(None, [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.gis',
    'rest_framework',
    'parler',
    'cfh',
    'issues',
    'issues_citysdk',
    'issues_media',
    'issues_hel',
    'issues_log',
开发者ID:6aika,项目名称:issue-reporting,代码行数:33,代码来源:settings.py

示例7: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [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

示例8:

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]

########## WSGI CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#wsgi-application
WSGI_APPLICATION = '%s.wsgi.application' % PACKAGE_NAME
########## END WSGI CONFIGURATION


########## SOUTH CONFIGURATION
# See: http://south.readthedocs.org/en/latest/installation.html#configuring-your-django-installation
INSTALLED_APPS += (
    # Database migration helpers:
    'south',
)
# Don't need to use South when setting up a test database.
SOUTH_TESTS_MIGRATE = False
SOUTH_DATABASE_ADAPTERS = {'default':'south.db.postgresql_psycopg2'}

########## END SOUTH CONFIGURATION

########## ATTREZZI CONFIGURATION
ATTREZZI_ACCESSO_URL = env.str('ATTREZZI_ACCESSO_URL', 'http://example.com')
ATTREZZI = {
    'ACCESSO_ACCESS_TOKEN_URL': '%s/o/token/' % ATTREZZI_ACCESSO_URL,
    'ACCESSO_AUTHORIZE_URL': '%s/o/authorize/' % ATTREZZI_ACCESSO_URL,
    'ACCESSO_PROFILE_URL': '%s/api/v1/users/me' % ATTREZZI_ACCESSO_URL,
}
########## END ATTREZZI CONFIGURATION

LOGIN_REDIRECT_URL = "/"
ACCOUNT_EMAIL_VERIFICATION = None
开发者ID:openpolis,项目名称:op-verify,代码行数:32,代码来源:base.py

示例9: Env

# 需要导入模块: from environ import Env [as 别名]
# 或者: from environ.Env import str [as 别名]
from environ import Env
from django.utils.translation import ugettext_lazy as _

BASE_DIR = os.path.realpath(os.path.join(os.path.dirname(__file__), ".."))
assert os.path.exists(os.path.join(BASE_DIR, "manage.py"))

env = Env()

DEBUG = False
LANGUAGE_CODE = "fi"
LANGUAGES = [
    ('fi', _('Finnish')),
    ('sv', _('Swedish')),
    ('en', _('English'))
]
VAR_ROOT = env.str("VAR_ROOT", default=BASE_DIR)
if not os.path.isdir(VAR_ROOT):
    os.makedirs(VAR_ROOT)
MEDIA_ROOT = os.path.join(VAR_ROOT, "media")
MEDIA_URL = "/media/"
ROOT_URLCONF = "paatos.urls"
STATIC_ROOT = os.path.join(VAR_ROOT, "static")
STATIC_URL = "/static/"
TIME_ZONE = "Europe/Helsinki"
USE_I18N = True
USE_L10N = True
USE_TZ = True
WSGI_APPLICATION = "paatos.wsgi.application"


INSTALLED_APPS = [
开发者ID:aapris,项目名称:paatos,代码行数:33,代码来源:settings.py


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