示例#1
0
# -*- coding: utf-8 -*-
from project.configuration import Configuration
from project.configuration.utils import env_var

__version__ = '0.1'
from flask import Flask
import jinja2

app = Flask('project')

# You can play with the settings below

app.debug = env_var('DEBUG', True)
app.debug_toolbar = env_var('DEBUG_TOOLBAR', False)
app.testing = env_var('TESTING',
                      False)  # set to true so recaptcha always validate

app.config.update(
    dict(
        DATABASE='./db/main.db',
        DEBUG=app.debug,
        TESTING=app.testing,
        SECRET_KEY=env_var('SECRET_KEY'),
        USERNAME=env_var('BENCHMARK_USERNAME', 'admin'),
        PASSWORD=env_var('BENCHMARK_PASSWORD', 'default'),
        # To get your keys: https://www.google.com/recaptcha/admin#whyrecaptcha
        RECAPTCHA_USE_SSL=env_var('RECAPTCHA_USE_SSL', False),
        RECAPTCHA_PUBLIC_KEY=env_var('RECAPTCHA_PUBLIC_KEY', ''),
        RECAPTCHA_PRIVATE_KEY=env_var('RECAPTCHA_PRIVATE_KEY', ''),
        RECAPTCHA_OPTIONS=env_var('RECAPTCHA_OPTIONS', ''),
        SQLALCHEMY_TRACK_MODIFICATIONS=env_var(
示例#2
0
# -*- coding: utf-8 -*-
from project.configuration import Configuration
from project.configuration.utils import env_var

__version__ = '0.1'
from flask import Flask
import jinja2

app = Flask('project')

# You can play with the settings below

app.debug = env_var('DEBUG', True)
app.debug_toolbar = env_var('DEBUG_TOOLBAR', False)
app.testing = env_var('TESTING', False)  # set to true so recaptcha always validate

app.config.update(dict(
    DATABASE='./db/main.db',
    DEBUG=app.debug,
    TESTING=app.testing,
    SECRET_KEY=env_var('SECRET_KEY'),
    USERNAME=env_var('BENCHMARK_USERNAME', 'admin'),
    PASSWORD=env_var('BENCHMARK_PASSWORD', 'default'),
    # To get your keys: https://www.google.com/recaptcha/admin#whyrecaptcha
    RECAPTCHA_USE_SSL=env_var('RECAPTCHA_USE_SSL', False),
    RECAPTCHA_PUBLIC_KEY=env_var('RECAPTCHA_PUBLIC_KEY', ''),
    RECAPTCHA_PRIVATE_KEY=env_var('RECAPTCHA_PRIVATE_KEY', ''),
    RECAPTCHA_OPTIONS=env_var('RECAPTCHA_OPTIONS', ''),
    SQLALCHEMY_TRACK_MODIFICATIONS=env_var('SQLALCHEMY_TRACK_MODIFICATIONS', False)
))
def test_env_var_str():
    assert env_var('FOO') is 'bar'
def test_env_var_true():
    assert env_var('TRUE_ENV_VAR') is True
def test_env_var_false():
    assert env_var('FALSE_ENV_VAR') is False
def test_env_var_unset():
    assert env_var('UNSET_ENV_VAR') is None