~homeworkprod/byceps

1372bb96b216f267cd786184d9ce2381f29c707b — Jochen Kupperschmidt 5 years ago 903fa92
Replace redundant code
1 files changed, 4 insertions(+), 15 deletions(-)

M serve.py
M serve.py => serve.py +4 -15
@@ 1,20 1,9 @@
# -*- coding: utf-8 -*-

import os
import sys

from byceps.application import create_app, init_app


CONFIG_ENV_VAR_NAME = 'BYCEPS_CONFIG'


environment = os.environ.get(CONFIG_ENV_VAR_NAME)

if environment is None:
    sys.stderr.write("Environment variable '{}' must be set but isn't."
                     .format(CONFIG_ENV_VAR_NAME))
try:
    from byceps.application_factory import app
except Exception as e:
    sys.stderr.write("{}\n".format(e))
    sys.exit()

app = create_app(environment)
init_app(app)