Exemple #1
0
def make_flask_app():
    project_env = ProjectEnv.detect_from_os(fallback_to_default=True)
    runlevel = RunLevel.detect_from_os(fallback_to_default=True)
    config = nest_config.generate_config(project_env, runlevel)
    print('make flask app:  ' + str(project_env) + '  ' + str(runlevel))
    app = create_app(config, project_env, runlevel)
    return app
Exemple #2
0
def test_deploy_os_roundtrip():
    #delete Deploy_ENV if it's currently set
    os.environ.pop("DEPLOY_ENV", None)

    env_obs = RunLevel.detect_from_os()
    assert env_obs == None

    env_obs = RunLevel.detect_from_os(fallback_to_default=True)
    assert env_obs == RunLevel.default_instance()

    env1 = RunLevel.default_instance()
    assert not env1 == None
    env1.write_to_os()
    env_obs = RunLevel.detect_from_os()
    assert env1 == env_obs
    return
Exemple #3
0
def generate_config_from_os():
    """
    Determines runlevel and project_env from environment variables, then
    returns generate_eve_config(project_env, runlevel).
    """
    project_env = ProjectEnv.detect_from_os(fallback_to_default=True)
    print "Detected PROJECT_ENV: " + str(project_env)

    runlevel = RunLevel.detect_from_os(fallback_to_default=True)
    print "Detected RUN_LEVEL: " + str(runlevel)

    return generate_config(project_env, runlevel)