Exemplo n.º 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
Exemplo n.º 2
0
def test_project_os_roundtrip():
    #delete PROJECT_ENV if it's currently set
    os.environ.pop("PROJECT_ENV", None)

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

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

    env1 = ProjectEnv.default_instance()
    assert not env1 == None
    env1.write_to_os()
    env_obs = ProjectEnv.detect_from_os()
    assert env1 == env_obs

    env_obs = ProjectEnv.detect_from_os(fallback_to_default=True)
    assert env1 == env_obs
    return
Exemplo n.º 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)