Exemple #1
0
def test_envelop_environment_get_uri_returning_none():
    # Given that I have an empty environment
    env = Environment()

    # When I try to get a uri variable that doesn't exist, then I get None
    assert env.get_uri('blah') is None

    # And When I try to get a variable that doesn't exist but I provide a
    # default value, it will be returned instead of none
    assert env.get_uri('blah', 'http://yipit.com').host == 'yipit.com'
Exemple #2
0
def test_envelop_environment_get_uri():
    # Given that I have an environment with a variable containing a uri
    env = Environment()
    env.set('githubpage', 'https://*****:*****@github.com/yipit/envelop')

    # When I try to get the value as a Uri
    uri = env.get_uri('githubpage')

    # Then I see things working
    assert uri.scheme == 'https'
    assert uri.host == 'github.com'
    assert uri.port is None
    assert uri.user == 'clarete'
    assert uri.password == 'passwd!!'
    assert uri.path == '/yipit/envelop'
    assert uri.relative_path == 'yipit/envelop'
Exemple #3
0
    raise ImportError('could not import milieu, please make sure it is installed (pip install milieu)')

env = Environment()

SECRET_KEY = '8y2v7mq%foapmsuftqu#)_muync$+x7$$n7$3!66kwblvh40%w'

DEBUG = True
PRODUCTION = False

LOCAL_FILE = lambda *parts: join(abspath(dirname(__file__)), *parts)

TEMPLATE_DEBUG = DEBUG

SITE_DOMAIN = env.get('SITE_DOMAIN', '127.0.0.1:8000')

db_auth = env.get_uri('DATABASE_DEFAULT', "mysql://root@localhost/tckt")
db_options = {
    'init_command': 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
    'compress': True
}

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.{0}'.format(db_auth.scheme),
        'NAME': db_auth.path.replace('/', ''),
        'HOST': db_auth.host,
        'PORT': db_auth.port,
        'USER': db_auth.user,
        'PASSWORD': db_auth.password,
        'OPTIONS': db_options,
    },
Exemple #4
0
# Detecting environment
DEBUG = env.get_bool('DEBUG')

# HTTP
HOST = env.get("HOST") or 'oldspeak'
DOMAIN = env.get("DOMAIN") or '{HOST}:{PORT}'.format(**locals())
SCHEME = env.get('SCHEME') or (
    'oldspeak' not in DOMAIN and 'https://' or 'http://')
LOG_LEVEL_NAME = (env.get('LOG_LEVEL') or 'INFO').upper()

# Database-related

SQLALCHEMY_DATABASE_URI = env.get('SQLALCHEMY_DATABASE_URI', 'postgresql+psycopg2://01d5pk:kp5d10@localhost/01d5pk')
DATA_DIR = env.get('OLDSPEAK_DATADIR', "~/.oldspeak/data")
REDIS_URI = env.get_uri("REDIS_URI") or 'redis://*****:*****@oldspeak'

GEVENT_MAX_CONNECTIONS = 1024 * 32

API_TOKEN_EXPIRATION_TIME = 60 * 60 * 12  # 12 hours in seconds
Exemple #5
0
    )

env = Environment()

SECRET_KEY = '8y2v7mq%foapmsuftqu#)_muync$+x7$$n7$3!66kwblvh40%w'

DEBUG = True
PRODUCTION = False

LOCAL_FILE = lambda *parts: join(abspath(dirname(__file__)), *parts)

TEMPLATE_DEBUG = DEBUG

SITE_DOMAIN = env.get('SITE_DOMAIN', '127.0.0.1:8000')

db_auth = env.get_uri('DATABASE_DEFAULT', "mysql://root@localhost/tckt")
db_options = {
    'init_command': 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
    'compress': True
}

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.{0}'.format(db_auth.scheme),
        'NAME': db_auth.path.replace('/', ''),
        'HOST': db_auth.host,
        'PORT': db_auth.port,
        'USER': db_auth.user,
        'PASSWORD': db_auth.password,
        'OPTIONS': db_options,
    },