예제 #1
0
 def test_get_env(self):
     # too many args - we only support one default value ('bar')
     self.assertRaises(AssertionError, get_env, 'foo', 'bar', 'baz')
     # missing env var, use default
     del self.environ['FOO']
     self.assertRaises(RequiredSettingMissing, get_env, 'FOO', coerce=lambda x: x)
     self.assertEqual(get_env('FOO', 'bar', coerce=lambda x: x), 'bar')
     # valid env var
     self.assertFunc(get_env, 'foo', 'foo')
]

CONTEXT_PROCESSORS = [
    "django.contrib.auth.context_processors.auth",
    "django.template.context_processors.debug",
    "django.template.context_processors.i18n",
    "django.template.context_processors.media",
    "django.template.context_processors.static",
    "django.template.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
]

# Registration settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_DEFAULT_FROM_EMAIL = get_env("DEFAULT_FROM_EMAIL",
                                          "*****@*****.**")
REGISTRATION_EMAIL_HTML = True
REGISTRATION_AUTO_LOGIN = True

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = get_env('DEFAULT_FROM_EMAIL', 'webmaster@localhost')

# User image uploads to S3 bucket
AWS_STORAGE_BUCKET_NAME = get_env("AWS_BUCKET_NAME", "pimpmycause-images")
S3DIRECT_REGION = get_env("AWS_BUCKET_NAME", 'eu-west-1')

S3DIRECT_DESTINATIONS = {
예제 #3
0
파일: common.py 프로젝트: JadaOne/reminder
    },
    {
        "NAME":
        "django.contrib.auth.password_validation.CommonPasswordValidator",
    },
    {
        "NAME":
        "django.contrib.auth.password_validation.NumericPasswordValidator",
    },
]

# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_L10N = True

USE_TZ = True

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = "/static/"

FROM_MAIL = get_env("FROM_MAIL", "*****@*****.**")
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static-bundles'), )

CONTEXT_PROCESSORS = [
    "django.contrib.auth.context_processors.auth",
    "django.template.context_processors.debug",
    "django.template.context_processors.i18n",
    "django.template.context_processors.media",
    "django.template.context_processors.static",
    "django.template.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
]

# Registration settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_DEFAULT_FROM_EMAIL = get_env("DEFAULT_FROM_EMAIL",
                                          "*****@*****.**")
REGISTRATION_EMAIL_HTML = True
REGISTRATION_AUTO_LOGIN = True

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = get_env('DEFAULT_FROM_EMAIL',
                             '*****@*****.**"')

# AWS Settings
AWS_ACCESS_KEY_ID = get_env("AWS_ACCESS_KEY_ID", 'todo')
AWS_SECRET_ACCESS_KEY = get_env("AWS_SECRET_ACCESS_KEY", 'todo')
AWS_STORAGE_BUCKET_NAME = get_env("AWS_STORAGE_BUCKET_NAME", 'todo')
예제 #5
0
from env_utils import get_bool, get_env, get_int  # noqa

RQ_QUEUES = {
    "default": {
        "HOST": get_env("RQ_HOST", "localhost"),
        "PORT": get_int("RQ_PORT", 6379),
        "DB": get_int("RQ_DB", 0),
        "PASSWORD": get_env("RQ_PASSWORD", ""),
        "DEFAULT_TIMEOUT": 360,
    },
    "high": {
        "HOST": get_env("RQ_HOST", "localhost"),
        "PORT": get_int("RQ_PORT", 6379),
        "DB": get_int("RQ_DB", 0),
        "PASSWORD": get_env("RQ_PASSWORD", ""),
        "DEFAULT_TIMEOUT": 360,
    },
    "low": {
        "HOST": get_env("RQ_HOST", "localhost"),
        "PORT": get_int("RQ_PORT", 6379),
        "DB": get_int("RQ_DB", 0),
        "PASSWORD": get_env("RQ_PASSWORD", ""),
        "DEFAULT_TIMEOUT": 360,
    },
}
예제 #6
0
파일: base.py 프로젝트: manti-by/helios
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
import os

from env_utils import get_int, get_env, get_bool, get_decimal  # noqa
from pathlib import Path

# 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/latest/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = get_env("SECRET_KEY", "secret-key")

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

ALLOWED_HOSTS = ("*", )

# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.sites",
    "django.contrib.messages",
예제 #7
0
)

CONTEXT_PROCESSORS = [
    "django.contrib.auth.context_processors.auth",
    "django.template.context_processors.debug",
    "django.template.context_processors.i18n",
    "django.template.context_processors.media",
    "django.template.context_processors.static",
    "django.template.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
]

# Registration settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_DEFAULT_FROM_EMAIL = get_env("DEFAULT_FROM_EMAIL", "*****@*****.**")
REGISTRATION_EMAIL_HTML = True
REGISTRATION_AUTO_LOGIN = True


EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = get_env('DEFAULT_FROM_EMAIL', '*****@*****.**"')

# AWS Settings
AWS_ACCESS_KEY_ID = get_env("AWS_ACCESS_KEY_ID", 'todo')
AWS_SECRET_ACCESS_KEY = get_env("AWS_SECRET_ACCESS_KEY", 'todo')
AWS_STORAGE_BUCKET_NAME = get_env("AWS_STORAGE_BUCKET_NAME", 'todo')
예제 #8
0
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'wsgi.application'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': get_env('DATABASE_NAME', 'statlord'),
        'USER': get_env('DATABASE_USER', 'statlord'),
        'PASSWORD': get_env('DATABASE_PASSWORD', ''),
        'HOST': get_env('DATABASE_HOST', 'localhost'),
        'PORT': get_int('DATABASE_PORT', 5432)
    }
}

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME':
        'django.contrib.auth.password_validation.MinimumLengthValidator',
예제 #9
0
from env_utils import get_bool, get_env, get_int  # noqa

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.postgresql_psycopg2",
        "NAME": get_env("DB_NAME", "reminder"),
        "USER": get_env("DB_USER", "reminder"),
        "PASSWORD": get_env("DB_PASS", "reminder"),
        "HOST": get_env("DB_HOST", "127.0.0.1"),
        "PORT": get_env("DB_PORT", "5432"),
    }
}
예제 #10
0
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]

WSGI_APPLICATION = 'sharespots.wsgi.application'

############
# Database #
############

DATABASE_URL = get_env('DATABASE_URL')

DATABASES = dict(default=dj_database_url.config(default=DATABASE_URL))

DATABASES['default']['ATOMIC_REQUESTS'] = True

DATABASES['default']['CONN_MAX_AGE'] = 600

# Password validation
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME':
        'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
예제 #11
0
# Train with curriculum learning using the DeepRL code
import argparse
from gridworlds.envs import GridWorldEnv
from env_utils import get_env
from gridworlds.getch import getch
import numpy as np
import sys

parser = argparse.ArgumentParser("Train an agent to navigate to goals in a 2D world")

parser.add_argument('--seed', type=int, default=13)

args = parser.parse_args()


env = get_env()





if False:

    # use a random agent to see if things work
    num_episodes = 10
    time_steps = 1000
    returns = np.zeros((num_episodes,))

    # using WASD instead of arrow keys for consistency
    UP = 119  # W
    LEFT = 97  # A
예제 #12
0
STATICFILES_DIRS = (os.path.join(BASE_DIR, 'static-bundles'), )

CONTEXT_PROCESSORS = [
    "django.contrib.auth.context_processors.auth",
    "django.template.context_processors.debug",
    "django.template.context_processors.i18n",
    "django.template.context_processors.media",
    "django.template.context_processors.static",
    "django.template.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    "django.core.context_processors.request",
]

# Registration settings
ACCOUNT_ACTIVATION_DAYS = 7
REGISTRATION_DEFAULT_FROM_EMAIL = get_env("DEFAULT_FROM_EMAIL",
                                          "*****@*****.**")
REGISTRATION_EMAIL_HTML = True
REGISTRATION_AUTO_LOGIN = True

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
DEFAULT_FROM_EMAIL = get_env('DEFAULT_FROM_EMAIL', '*****@*****.**"')

# AWS Settings
AWS_ACCESS_KEY_ID = get_env("AWS_ACCESS_KEY_ID", 'todo')
AWS_SECRET_ACCESS_KEY = get_env("AWS_SECRET_ACCESS_KEY", 'todo')
AWS_STORAGE_BUCKET_NAME = get_env("AWS_STORAGE_BUCKET_NAME", 'todo')