Exemple #1
0
if DATABASES['default'].get('ENGINE') == 'django.db.backends.mysql':
    DATABASES['default'].get('OPTIONS', {}).pop('sslmode', None)
    if env('MYSQL_SSL_CA', None):
        DATABASES['default'].setdefault('OPTIONS', {})\
            .setdefault('ssl', {}).setdefault('ca', env('MYSQL_SSL_CA', None))

# default to a sensible modern driver for Azure SQL
if DATABASES['default'].get('ENGINE') == 'sql_server.pyodbc':
    DATABASES['default'].setdefault('OPTIONS', {})\
        .setdefault('driver', 'ODBC Driver 17 for SQL Server')

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
SESSION_COOKIE_SECURE = env.bool('SESSION_COOKIE_SECURE', False)
CSRF_COOKIE_SECURE = env.bool('CSRF_COOKIE_SECURE', False)
CSRF_TRUSTED_ORIGINS = env.list('CSRF_TRUSTED_ORIGINS', [])

# Allow all host headers
# ALLOWED_HOSTS = ['*']

# Size of the batch for creating documents
# on the import phase
IMPORT_BATCH_SIZE = env.int('IMPORT_BATCH_SIZE', 500)

GOOGLE_TRACKING_ID = env('GOOGLE_TRACKING_ID', 'UA-125643874-2').strip()

AZURE_APPINSIGHTS_IKEY = env('AZURE_APPINSIGHTS_IKEY', None)
APPLICATION_INSIGHTS = {
    'ikey': AZURE_APPINSIGHTS_IKEY if AZURE_APPINSIGHTS_IKEY else None,
    'endpoint': env('AZURE_APPINSIGHTS_ENDPOINT', None),
}
Exemple #2
0
from environs import Env

# Теперь используем вместо библиотеки python-dotenv библиотеку environs
env = Env()
env.read_env()

BOT_TOKEN = env.str("BOT_TOKEN")  # Забираем значение типа str
ADMINS = env.list("ADMINS")  # Тут у нас будет список из админов
QIWI_NUMBER = env.str("QIWI_NUMBER")
QIWI_TOKEN = env.str("QIWI_TOKEN")
IP = env.str("ip")  # Тоже str, но для айпи адреса хоста
Exemple #3
0
from environs import Env

# Теперь используем вместо библиотеки python-dotenv библиотеку environs
env = Env()
env.read_env()

BOT_TOKEN = env.str("BOT_TOKEN")  # Забираем значение типа str
ADMINS = env.list("ADMINS")
ip = env.str("ip")

PG_HOST = env.str('PG_HOST')
PGUSER = env.str("PGUSER")
PGPASSWORD = env.str("PGPASSWORD")
DATABASE = env.str("DATABASE")

REDIS_HOST = env.str('REDIS_HOST')

PROVIDER_TOKEN = env.str('PROVIDER_TOKEN')

POSTGRES_URI = f'postgresql://{PGUSER}:{PGPASSWORD}@{PG_HOST}/{DATABASE}'
import os
from environs import Env

env = Env()
env.read_env()

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', [])

SECRET_KEY = env.str('SECRET_KEY', 'REPLACE_ME')

DEBUG = env.bool('DEBUG', True)

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'debug_toolbar',
    'blog',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
# definition of proxy number
PROXY_NUMBER_MAX = 50000
PROXY_NUMBER_MIN = 0

# definition of tester cycle, it will test every CYCLE_TESTER second
CYCLE_TESTER = env.int('CYCLE_TESTER', 20)
# definition of getter cycle, it will get proxy every CYCLE_GETTER second
CYCLE_GETTER = env.int('CYCLE_GETTER', 100)

# definition of tester
TEST_URL = env.str('TEST_URL', 'http://www.baidu.com')
TEST_TIMEOUT = env.int('TEST_TIMEOUT', 10)
TEST_BATCH = env.int('TEST_BATCH', 20)
# TEST_HEADERS = env.json('TEST_HEADERS', {
#     'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36',
# })
TEST_VALID_STATUS = env.list('TEST_VALID_STATUS', [200, 206, 302])

# definition of api
API_HOST = env.str('API_HOST', '0.0.0.0')
API_PORT = env.int('API_PORT', 5555)
API_THREADED = env.bool('API_THREADED', True)

# flags of enable
ENABLE_TESTER = env.bool('ENABLE_TESTER', True)
ENABLE_GETTER = env.bool('ENABLE_GETTER', True)
ENABLE_SERVER = env.bool('ENABLE_SERVER', True)

logger.add(env.str('LOG_RUNTIME_FILE', 'runtime.log'), level='DEBUG', rotation='1 week', retention='20 days')
logger.add(env.str('LOG_ERROR_FILE', 'error.log'), level='ERROR', rotation='1 week')
Exemple #6
0
from environs import Env

env = Env()
env.read_env()

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG', default=True)
YANDEX_GEO_API_KEY = env.str('YANDEX_GEO_API_KEY')

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['127.0.0.1', 'localhost'])

INSTALLED_APPS = [
    'foodcartapp.apps.FoodcartappConfig',
    'restaurateur.apps.RestaurateurConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'debug_toolbar',
    'phonenumber_field',
    'rest_framework',
]
Exemple #7
0
# -*- coding: utf-8 -*-
import logging

from environs import Env
try:
    from app import create_app
except ImportError:
    from formsend.app import create_app

env = Env()
# Read .env into os.environ
env.read_env()

app = create_app(
    allowed_recipients=env.list('ALLOWED_RECIPIENTS', subject=set),
    mail_server=env.str('MAIL_SERVER'),
    mail_port=env.int('MAIL_PORT', 25),
    mail_use_tls=env.bool('MAIL_USE_TLS'),
    mail_use_ssl=env.bool('MAIL_USE_SSL'),
    mail_username=env.str('MAIL_USERNAME', default=None),
    mail_password=env.str('MAIL_PASSWORD', default=None),
    mail_sender=env.str('MAIL_SENDER'),
    mail_max_emails=env.int('MAIL_MAX_EMAILS', default=None),
)
app.logger.setLevel(logging.INFO)
Exemple #8
0
env.read_env()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str("SECRET_KEY",
                     'd0e#=%qi73svv%!qc!#@$ygybs#!@00lkhps+we2tblh^0_3xm')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG', True)

ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", ['127.0.0.1', 'localhost'],
                         subcast=str)

# Application definition

AUTH_USER_MODEL = 'usuarios.User'
CACHE_MIDDLEWARE_SECONDS = env.int("CACHE_SECONDS", 5)
CORS_ORIGIN_ALLOW_ALL = True

# Twilio
PHONE_NUMBER = env.str('PHONE_NUMBER', default='')
TW_SID = env.str('TW_SID', default='')
TW_TOKEN = env.str('TW_TOKEN', default='')

# Phone number field
PHONENUMBER_DEFAULT_REGION = 'BR'
Exemple #9
0
import os
from environs import Env

env = Env()
env.read_env()

HOST = env('HOST')
PORT = env('PORT')
NAME = env('NAME')
USER = env('USER_DB')
PASSWORD = env('PASSWORD_DB')
DEBUG = env.bool('DEBUG_APP')
SECRET_KEY = env('SECRET_KEY')
ALLOWED_HOSTS_APP = env.list('ALLOWED_HOSTS_APP')

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'HOST': HOST,
        'PORT': PORT,
        'NAME': NAME,
        'USER': USER,
        'PASSWORD': PASSWORD,
    }
}

INSTALLED_APPS = ['datacenter']

SECRET_KEY = SECRET_KEY

DEBUG = DEBUG
Exemple #10
0
env.read_env()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str(
    'SECRET_KEY', default='mw5_z3)(78aezbrdph=a)8gsrvi@+#gk17w7jvblbfo%9#d!zh')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG', default=True)

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default='127.0.0.1')

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'places.apps.PlacesConfig',
    'adminsortable2',
    'tinymce',
]
Exemple #11
0
env = Env()
print(env.dump())
# reading an environment variable
gh_user = env("GITHUB_USER")  # => 'sloria'
print(env.dump())
# casting
api_key = env.str("API_KEY")  # => '123abc'
date = env.date("SHIP_DATE")  # => datetime.date(1984, 6, 25)
print(env.dump())
# providing a default value
enable_login = env.bool("ENABLE_LOGIN", False)  # => True
enable_feature_x = env.bool("ENABLE_FEATURE_X", False)  # => False
print(env.dump())
# parsing lists
gh_repos = env.list("GITHUB_REPOS")  # => ['webargs', 'konch', 'ped']
coords = env.list("COORDINATES", subcast=float)  # => [23.3, 50.0]
print(env.dump())

with env.prefixed("MYAPP_"):
    host = env("HOST", "localhost")
    port = env.int("PORT", 5000)
    print(env.dump())

print(env.dump())

# json.load(env.dump())
with open('simple_example.json', 'w') as outfile:
    json.dump(env.dump(), outfile)

pprint(env.dump(), indent=2)
Exemple #12
0
from environs import Env

env = Env()
env.read_env()

BOT_TOKEN = env.str("BOT_TOKEN")
SUPERUSER_ID = env.list("SUPERUSER_ID")
IP = env.str("IP")

PG_USER = env.str("POSTGRES_USER")
PG_PASSWORD = env.str("POSTGRES_PASSWORD")
DATABASE = env.str("POSTGRES_DATABASE")

QIWI_TOKEN = env.str("qiwi")
WALLET_QIWI = env.str("wallet")
QIWI_PUBKEY = env.str("qiwi_pub")

EMAIL_ADDRESS = env.str("EMAIL_ADDRESS")
EMAIL_PASSWORD = env.str("EMAIL_PASSWORD")

DB_HOST = IP

POSTGRES_URI = f"postgresql://{PG_USER}:{PG_PASSWORD}@{DB_HOST}/{DATABASE}"
Exemple #13
0
_DEFAULT_OTEL_EXPORTER_OTLP_METRIC_ENDPOINT = (
    "ingest.lightstep.com:443/metrics"
)

_LS_ACCESS_TOKEN = _env.str("LS_ACCESS_TOKEN", None)
_OTEL_EXPORTER_OTLP_SPAN_ENDPOINT = _env.str(
    "OTEL_EXPORTER_OTLP_SPAN_ENDPOINT",
    _DEFAULT_OTEL_EXPORTER_OTLP_SPAN_ENDPOINT,
)
_OTEL_EXPORTER_OTLP_METRIC_ENDPOINT = _env.str(
    "OTEL_EXPORTER_OTLP_METRIC_ENDPOINT",
    _DEFAULT_OTEL_EXPORTER_OTLP_METRIC_ENDPOINT,
)
_LS_SERVICE_NAME = _env.str("LS_SERVICE_NAME", None)
_LS_SERVICE_VERSION = _env.str("LS_SERVICE_VERSION", "unknown")
_OTEL_PROPAGATORS = _env.list("OTEL_PROPAGATORS", ["b3"])
_OTEL_RESOURCE_LABELS = _env.dict(
    "OTEL_RESOURCE_LABELS",
    {
        "service.name": _LS_SERVICE_NAME,
        "service.version": _LS_SERVICE_VERSION,
        "telemetry.sdk.language": "python",
        "telemetry.sdk.version": __version__,
    },
)
_OTEL_LOG_LEVEL = _env.int("OTEL_LOG_LEVEL", DEBUG)
_OTEL_EXPORTER_OTLP_SPAN_INSECURE = _env.bool(
    "OTEL_EXPORTER_OTLP_SPAN_INSECURE", False
)
_OTEL_EXPORTER_OTLP_METRIC_INSECURE = _env.bool(
    "OTEL_EXPORTER_OTLP_METRIC_INSECURE", False
Exemple #14
0
DEFAULT_FROM_EMAIL = '*****@*****.**'

SERVER_EMAIL = '*****@*****.**'
EMAIL_SUBJECT_PREFIX = '[funrun] '  # for mailing admins and managers

SECRET_KEY = env('SECRET_KEY', None)  # generate a random key with 'pwgen -s 50 -n 1'

DEBUG = env.bool('DEBUG', False)
SENTRY_DSN = env('SENTRY_DSN', None)
if SENTRY_DSN:
	RAVEN_CONFIG = {'dsn': SENTRY_DSN}
	INSTALLED_APPS.insert(0, 'raven.contrib.django.raven_compat')

DATABASES = {
	'default': env.db_settings('DATABASE_URL', 'postgres://localhost/funrun')
}

if env('EMAIL_URL', None):
	vars().update(env.email_settings('EMAIL_URL'))

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', [])


# Pagination

MATCHES_PER_PAGE = 10


from conf.local import *
Exemple #15
0
# ---------------------------------------------------
ROUTE_API = env.dict(
    "ROUTE_API", {
        'capture_subscribe': '/v2raycs/api/capture_subscribe',
        'version_manager': '/v2raycs/api/version_manager',
    })
# ---------------------------------------------------
# 任务队列
# ---------------------------------------------------
SEQ_TEST = env.dict("SEQ_TEST", {
    'v2ray': True,
    'ssr': True,
    'trojan': False,
})

CRAWLER_SEQUENCE = env.list("CRAWLER_SEQUENCE",
                            [i[0] for i in SEQ_TEST.items() if i[-1]])
"""********************************* 客户端桌面前端配置 *********************************"""
# ---------------------------------------------------
# 工程目录(系统核心文件,请勿删改)基于Windows10设计
# ---------------------------------------------------
"""
--ROOT
   --logs
       --*error.log
       --*runtime.log
   --database
       --FetchRequestsHistory.txt
       --*FetchAirEcologyInfo.csv
       --user.yaml
   --depot
       --client
Exemple #16
0
wallets_module = importlib.import_module("lnbits.wallets")
wallet_class = getattr(
    wallets_module, env.str("LNBITS_BACKEND_WALLET_CLASS",
                            default="VoidWallet"))

ENV = env.str("QUART_ENV", default="production")
DEBUG = env.bool("QUART_DEBUG", default=False) or ENV == "development"
HOST = env.str("HOST", default="127.0.0.1")
PORT = env.int("PORT", default=5000)

LNBITS_PATH = path.dirname(path.realpath(__file__))
LNBITS_DATA_FOLDER = env.str("LNBITS_DATA_FOLDER",
                             default=path.join(LNBITS_PATH, "data"))
LNBITS_ALLOWED_USERS: List[str] = env.list("LNBITS_ALLOWED_USERS",
                                           default=[],
                                           subcast=str)
LNBITS_DISABLED_EXTENSIONS: List[str] = env.list("LNBITS_DISABLED_EXTENSIONS",
                                                 default=[],
                                                 subcast=str)
LNBITS_SITE_TITLE = env.str("LNBITS_SITE_TITLE", default="LNbits")

WALLET = wallet_class()
DEFAULT_WALLET_NAME = env.str("LNBITS_DEFAULT_WALLET_NAME",
                              default="LNbits wallet")
PREFER_SECURE_URLS = env.bool("LNBITS_FORCE_HTTPS", default=True)

SERVICE_FEE = env.float("LNBITS_SERVICE_FEE", default=0.0)

try:
    LNBITS_COMMIT = subprocess.check_output(
]
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!

SECRET_KEY = env.str("SECRET_KEY")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG")
if DEBUG:
    logger.warning("RUNNING IN DEBUG MODE")
else:
    logger.info("RUNNING IN PRODUCTION")

ALLOWED_HOSTS = [host.replace(" ", "") for host in env.list("ALLOWED_HOSTS")]
BASE_URL = os.environ["BASE_URL"]

# Application definition

INSTALLED_APPS = (
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "bootstrap3",
    "corsheaders",
    "members",
    "crispy_forms",
    "django_cron",
Exemple #18
0
from environs import Env

env = Env()
env.read_env()

API_KEY = env.str('API_KEY')
BOT_TOKEN = env.str("BOT_TOKEN")
SKIP_UPDATES = env.bool("SKIP_UPDATES", True)
WORK_PATH = env.str('WORK_PATH')
ADMIN_IDS = env.list('ADMIN_IDS')
ID_CHANNEL = env.str('ID_CHANNEL')
Exemple #19
0
os.environ["GITHUB_USER"] = "******"
os.environ["API_KEY"] = "123abc"
os.environ["SHIP_DATE"] = "1984-06-25"
os.environ["ENABLE_LOGIN"] = "******"
os.environ["MAX_CONNECTIONS"] = "42"
os.environ["GITHUB_REPOS"] = "webargs,konch,ped"
os.environ["COORDINATES"] = "23.3,50.0"
os.environ["MYAPP_HOST"] = "lolcathost"
os.environ["MYAPP_PORT"] = "3000"


env = Env()
# reading an environment variable
gh_user = env("GITHUB_USER")  # => 'sloria'
# casting
api_key = env.str("API_KEY")  # => '123abc'
date = env.date("SHIP_DATE")  # => datetime.date(1984, 6, 25)
# providing a default value
enable_login = env.bool("ENABLE_LOGIN", False)  # => True
enable_feature_x = env.bool("ENABLE_FEATURE_X", False)  # => False
# parsing lists
gh_repos = env.list("GITHUB_REPOS")  # => ['webargs', 'konch', 'ped']
coords = env.list("COORDINATES", subcast=float)  # => [23.3, 50.0]

with env.prefixed("MYAPP_"):
    host = env("HOST", "localhost")
    port = env.int("PORT", 5000)

pprint(env.dump(), indent=2)
Exemple #20
0
    """Add hacktoberfest topic to the repo."""
    topics_list = repo.get_topics()
    if "hacktoberfest" not in topics_list:
        topics_list.append("hacktoberfest")
        repo.replace_topics(topics_list)


if __name__ == "__main__":
    env = Env()
    env.read_env()
    gh_repository = env("GITHUB_REPOSITORY")
    gh_token = env("INPUT_GITHUB_TOKEN")
    input_label_name = env("INPUT_EDIT_LABEL_NAME")
    input_label_color = env("INPUT_EDIT_LABEL_COLOR")
    input_label_description = env("INPUT_EDIT_LABEL_DESCRIPTION")
    input_filter_labels = env.list("INPUT_FILTER_LABEL")

    # In case it's set to an empty string, revert depending on date:
    # Revert if we're not in October
    if os.getenv("INPUT_REVERT", None) == "":
        today = dt.date.today()
        input_revert = today.month != 10
    else:
        input_revert = env.bool("INPUT_REVERT")

    main(
        gh_token,
        gh_repository,
        input_filter_labels,
        input_label_name,
        input_label_color,
Exemple #21
0
from environs import Env

from invite0 import data


env = Env()
env.read_env()

SERVER_NAME = env.str('INVITE0_DOMAIN')
ORG_NAME = env.str('ORG_NAME')
USER_FIELDS = env.list('USER_FIELDS', default=['picture', 'nickname', 'given_name', 'family_name'])
INVITE_EXPIRATION_DAYS = env.decimal('INVITE_EXPIRATION_DAYS', default=5)
INVITE_PERMISSION = env.str('INVITE_PERMISSION', default='send:invitation')
WELCOME_URL = env.url('WELCOME_URL', default=None).geturl()
SECRET_KEY = env.str('SECRET_KEY')

MAIL_SERVER = env.str('MAIL_SERVER')
MAIL_PORT = env.str('MAIL_PORT')
MAIL_USE_TLS = env.bool('MAIL_USE_TLS', default=False)
MAIL_USE_SSL = env.bool('MAIL_USE_SSL', default=False)
MAIL_USERNAME = env.str('MAIL_USERNAME')
MAIL_PASSWORD = env.str('MAIL_PASSWORD')
MAIL_SENDER_NAME = env.str('MAIL_SENDER_NAME', default=None)
MAIL_SENDER_ADDRESS = env.str('MAIL_SENDER_ADDRESS')
MAIL_MAX_EMAILS = env.int('MAIL_MAX_EMAILS', default=None)

AUTH0_CLIENT_ID = env.str('AUTH0_CLIENT_ID')
AUTH0_CLIENT_SECRET = env.str('AUTH0_CLIENT_SECRET')
AUTH0_AUDIENCE = env.str('AUTH0_AUDIENCE')
AUTH0_DOMAIN = env.str('AUTH0_DOMAIN')
from .utils import FilterSettings

env = Env()

DEBUG = False

BASE_DIR = Path(__file__).parent.parent

LOCALES_DIR = BASE_DIR / "locales"

I18N_DOMAIN = "messages"

BOT_TOKEN = env("BOT_TOKEN")

ADMINS = env.list("ADMINS", subcast=int)

BASE_URL = env("BASE_URL")

API_BASE_URL = furl(BASE_URL).add(path=env("API_PATH")).url

API_TOKEN = env("API_TOKEN")

PAYMENTS_PROVIDER_TOKEN = env("PAYMENTS_PROVIDER_TOKEN")

FSM_STORAGE = {"host": env("STORAGE_HOST"), "port": env.int("STORAGE_PORT")}

TIMEZONE = env("TIMEZONE", "UTC")

DATETIME_FORMAT = "%d/%m/%Y %H:%M:%S %Z%z"
Exemple #23
0
import os
from environs import Env

env = Env()
env.read_env()

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

COMPANY_COORDINATES = [55.751244, 37.618423]

ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", [])

SECRET_KEY = env.str("SECRET_KEY", "REPLACE_ME")

DEBUG = env.bool("DEBUG", True)

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'debug_toolbar',
    'blog',
]

MIDDLEWARE = [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
Exemple #24
0
from typing import Final

from environs import Env

# Теперь используем вместо библиотеки python-dotenv библиотеку environs
env = Env()
env.read_env()

BOT_TOKEN = env.str("BOT_TOKEN")  # Забираем значение типа str
ADMINS = [int(el) for el in env.list("ADMINS")]  # Тут у нас будет список из админов
IP = env.str("ip")  # Тоже str, но для айпи адреса хоста

DB_USER: Final[str] = env.str('POSTGRES_USER')
DB_PASS: Final[str] = env.str('POSTGRES_PASSWORD')
DB_HOST: Final[str] = env.str('POSTGRES_HOST')
DB_NAME: Final[str] = env.str('POSTGRES_DB')

NUMBER_PATTERN: Final[str] = r'^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$'
Exemple #25
0
from environs import Env

env = Env()


@env.parser_for('secure_ssl_header')
def _(value):
    if not value:
        return None
    return value, 'https'


with env.prefixed('DJANGO_'):
    DEBUG = env.bool('DEBUG', default=True)
    SECRET_KEY = env.str('SECRET_KEY', default='asdf')
    ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', default=[])
    CACHES = {'default': env.dj_cache_url('CACHE_URL', default='dummy://')}
    SECURE_PROXY_SSL_HEADER = env.secure_ssl_header('SECURE_PROXY_SSL_HEADER',
                                                    default=None)

INSTALLED_APPS = ['django.contrib.sessions']
SESSION_ENGINE = 'django.contrib.sessions.backends.signed_cookies'

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'emojiclock.middlewares.timezone_middleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
Exemple #26
0
from environs import Env

env = Env()
env.read_env()

DEBUG = env.bool("DEBUG", False)
PLUGIN_PACKAGES = env.list("DET_PLUGIN_PACKAGES", "detectem.plugins")

# General Splash configuration
SPLASH_URLS = env.list("SPLASH_URLS", ["http://localhost:8050"])
SETUP_SPLASH = env.bool("SETUP_SPLASH", True)
DOCKER_SPLASH_IMAGE = env("DOCKER_SPLASH_IMAGE", "scrapinghub/splash:latest")
NUMBER_OF_SPLASH_INSTANCES = env.int("NUMBER_OF_SPLASH_INSTANCES", 3)

# Splash internal settings
SPLASH_MAX_TIMEOUT = env.int("SPLASH_MAX_TIMEOUT", 120)
SPLASH_TIMEOUT = 30
SPLASH_MAX_RETRIES = 3


# CONSTANTS
JSON_OUTPUT = "json"
CMD_OUTPUT = "cmd"

VERSION_TYPE = "version"
INDICATOR_TYPE = "indicator"
HINT_TYPE = "hint"
GENERIC_TYPE = "generic"

RESOURCE_ENTRY = "resource"
MAIN_ENTRY = "main"
    DEBUG = env.bool('DEBUG', False)

    TEMPLATE_DEBUG = env.bool('TEMPLATE_DEBUG', False)

    HEADLESS = True
else:
    SECRET_KEY = 'dev'

    DEBUG = True

    TEMPLATE_DEBUG = True

    HEADLESS = env.bool('HEADLESS', False)

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['localhost', '127.0.0.1', '[::1]'])

INSTALLED_APPS = [
    'channels',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

MIDDLEWARE = [
    BASE_NAME + '.middleware.HealthMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
Exemple #28
0
from environs import Env

env = Env()
env.read_env()

BOT_TOKEN = env.str("BOT_TOKEN")
ADMINS = env.list("admins")

DB_USER = env.str("DB_USER")
DB_PASS = env.str("DB_PASS")
DB_NAME = env.str("DB_NAME")
DB_HOST = env.str("DB_HOST")



Exemple #29
0
env = Env()
env.read_env()

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str("SECRET_KEY", default="change-me")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG", default=False)

ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", default=["127.0.0.1"])
INTERNAL_IPS = env.list("INTERNAL_IPS", default=["127.0.0.1"])

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "places.apps.PlacesConfig",
    "adminsortable2",
    "tinymce",
]
Exemple #30
0
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = env('EMAIL_USE_TLS', True)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG', True)

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ['*'])
OL_URL = env('OL_URL')

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'django_rename_app',
    'bookwyrm',
    'celery',
Exemple #31
0
env = Env()

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str('APP_SECRET')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool('DEBUG_MODE', False)

ALLOWED_HOSTS = env.list('ALLOWED_HOSTS', ('localhost', '127.0.0.1'))

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rest_framework',
    'django_filters',
    'authentication',
]
                "INFO",
                validate=OneOf(
                    "DEBUG INFO WARN ERROR".split(),
                    error="LOG_LEVEL must be one of: {choices}",
                ),
            ),
        ),
    }

    ingestor_enabled = config["ingestor_enabled"] = env.bool("INGESTOR_ENABLED", False)
    with env.prefixed("INGESTOR_"):
        if ingestor_enabled:
            config.update(
                {
                    "ingestor_topic": env("TOPIC", None),
                    "ingestor_bootstap_servers": env.list("BOOTSTRAP_SERVERS"),
                    "ingestor_group_id": env("GROUP_ID"),
                    "ingestor_wait_interval": env("WAIT_INTERVAL", 0),
                    "ingestor_auto_offset_reset": env("AUTO_OFFSET_RESET", "earliest"),
                    "ingestor_max_poll_records": env.int("MAX_POLL_RECORDS", 500),
                    "ingestor_fetch_min_bytes": env.int("FETCH_MIN_BYTES", 1000),
                    "ingestor_table_ddl_content": env("TABLE_DLL_CONTENT", ""),
                    "ingestor_dataset": env("DATASET", ""),
                }
            )
            with env.prefixed("DATASET_"):
                config.update(
                    {
                        "ingestor_dataset_columns": env.list("COLUMNS", []),
                        "ingestor_dataset_ddl": env("DLL", ""),
                        "ingestor_dataset_autocreate": env.bool("AUTOCREATE", False),
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = env.str("SECRET_KEY",
                     "qt6mpx!55ioy(e8mulyp@v(qz%daoal#j&_ih0l352_8$gi$*j")

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DEBUG", False)

# NOTE: DO NOT DO THIS FOR ANY PRODUCTION DJANGO.
ALLOWED_HOSTS = env.list("ALLOWED_HOSTS", "127.0.0.1,localhost")

# Application definition

INSTALLED_APPS = [
    'data_ingestion_service',
    'django.contrib.admin',
    'django.contrib.auth',
    'mozilla_django_oidc',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

AUTHENTICATION_BACKENDS = [
env.read_env()

FLASK_ENV = env("FLASK_ENV")
LOG_LEVEL = (env("LOG_LEVEL", default="") or logging.getLevelName(logging.WARNING)).upper()

LOCAL_TIMEZONE = env("LOCAL_TIMEZONE", default="Europe/Berlin")
TELEGRAM_TOKEN = env("TELEGRAM_TOKEN", default=None)
TELEGRAM_IDLE_TIMEOUT = env.int("TELEGRAM_IDLE_TIMEOUT", default=120)

# By default, database will be refreshed every time a test runs.
REFRESH_TEST_DATABASE = env.bool("REFRESH_TEST_DATABASE", default=True)

LONG_OVERDUE = env.int("LONG_OVERDUE", default=14)
MEDIUM_OVERDUE = env.int("MEDIUM_OVERDUE", default=7)

ICONS = env.list("ICONS")

TOGGL_API_TOKEN = env("TOGGL_API_TOKEN")

#: Working hours
HOME_HOURS = env.int("HOME_HOURS")

#: How many minutes before the reminder should be set
HOME_MINUTES_BEFORE = env.int("HOME_MINUTES_BEFORE")

#: Toggl clients to count as working hours
HOME_TOGGL_CLIENTS = env.list("HOME_TOGGL_CLIENTS")

#: Tags that should not be considered working hours
HOME_TOGGL_NOT_WORK_TAGS = env.list("HOME_TOGGL_NOT_WORK_TAGS")