Nicholas Jones 7667a7b9af Fix pep8 errors
Fixes existing pep8 errors and reenables the corresponding tox rules

Change-Id: I4168a90c40173e4c35c9d75030cd592ace657508
2017-08-07 15:46:47 -05:00

38 lines
1000 B
Python
Executable File

import os
from cms_rest.logger import get_logger
from cms_rest import model
from cms_rest.utils import authentication
from orm_common.policy import policy
from orm_common.utils import utils
from pecan.commands import CommandRunner
from pecan import make_app
logger = get_logger(__name__)
def setup_app(config):
model.init_model()
token_conf = authentication._get_token_conf(config)
policy.init(config.authentication.policy_file, token_conf)
app_conf = dict(config.app)
# setting configurations for utils to be used from now and on
utils.set_utils_conf(config)
app = make_app(
app_conf.pop('root'),
logging=getattr(config, 'logging', {}),
**app_conf
)
logger.info('Starting CMS...')
return app
def main():
dir_name = os.path.dirname(__file__)
drive, path_and_file = os.path.splitdrive(dir_name)
path, filename = os.path.split(path_and_file)
runner = CommandRunner()
runner.run(['serve', path + '/config.py'])