diff --git a/ctl b/ctl index 537bfe4..c11896d 100755 --- a/ctl +++ b/ctl @@ -41,7 +41,8 @@ if [ "$1" == "start" ]; then echo openmedialibrary already running exit 1 fi - python2 oml server PID & + python2 oml server $PID + rm -f $PID exit $? fi if [ "$1" == "debug" ]; then diff --git a/oml/app.py b/oml/app.py index 2f3c5f7..d1ebb06 100644 --- a/oml/app.py +++ b/oml/app.py @@ -21,12 +21,6 @@ import api import commands -#FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s' -#logging.basicConfig(format=FORMAT) -#logger = logging.getLogger('oml.app') -#logger.warning('test') -logging.basicConfig(level=logging.DEBUG) - app = Flask('openmedialibrary', static_folder=settings.static_path) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////%s' % settings.db_path db.init_app(app) @@ -38,8 +32,8 @@ manager.add_command('db', MigrateCommand) manager.add_command('release', commands.Release) manager.add_command('debug', commands.Debug) manager.add_command('update', commands.Update) -#manager.add_command('start', commands.Start) -#manager.add_command('stop', commands.Stop) +manager.add_command('start', commands.Start) +manager.add_command('stop', commands.Stop) manager.add_command('setup', commands.Setup) manager.add_command('version', commands.Version) manager.add_command('postupdate', commands.PostUpdate) diff --git a/oml/server.py b/oml/server.py index 55774a9..d50ec4b 100644 --- a/oml/server.py +++ b/oml/server.py @@ -11,6 +11,7 @@ from tornado.ioloop import IOLoop from app import app import settings import websocket +import logging import state import node.server @@ -32,6 +33,12 @@ def run(): PID = sys.argv[2] if len(sys.argv) > 2 else None static_path = os.path.join(root_dir, 'static') + #FORMAT = '%(asctime)-15s %(clientip)s %(user)-8s %(message)s' + #logging.basicConfig(format=FORMAT) + #logger = logging.getLogger('oml.app') + #logger.warning('test') + if not PID: + logging.basicConfig(level=logging.DEBUG) options = { 'debug': False,