
Fixes existing pep8 errors and reenables the corresponding tox rules Change-Id: I4168a90c40173e4c35c9d75030cd592ace657508
36 lines
849 B
Python
36 lines
849 B
Python
"""app module."""
|
|
import logging
|
|
import os
|
|
|
|
from audit_server import model
|
|
from audit_server.storage import factory
|
|
from pecan.commands import CommandRunner
|
|
from pecan import make_app
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def setup_app(config):
|
|
"""setup method."""
|
|
model.init_model()
|
|
app_conf = dict(config.app)
|
|
factory.database_url = config.database.url
|
|
factory.echo_statements = config.database.echo_statements
|
|
|
|
app = make_app(
|
|
app_conf.pop('root'),
|
|
logging=getattr(config, 'logging', {}),
|
|
**app_conf
|
|
)
|
|
|
|
logger.info('Starting Audit...')
|
|
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'])
|