]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rest api: Set application variable when not executed as __main__
authorWido den Hollander <wido@42on.com>
Mon, 26 Jun 2017 09:50:50 +0000 (11:50 +0200)
committerWido den Hollander <wido@42on.com>
Mon, 26 Jun 2017 09:50:50 +0000 (11:50 +0200)
This allows for using this Python file as a WSGI module as it expects
a variable called application.

Signed-off-by: Wido den Hollander <wido@42on.com>
src/ceph-rest-api

index 6864028d365a699c27b59dc072f05c8c758ff1d4..d185a8041ef973ac08211c39732627534c8d9664 100755 (executable)
@@ -49,4 +49,7 @@ if 'pdb.py' in files:
     app.run(host=app.ceph_addr, port=app.ceph_port,
             debug=True, use_reloader=False, use_debugger=False)
 else:
-    app.run(host=app.ceph_addr, port=app.ceph_port)
+    if __name__ == '__main__':
+        app.run(host=app.ceph_addr, port=app.ceph_port)
+    else:
+        application = app