From e41bccbadf7e3881733b6bf8cd0d998b02fc9245 Mon Sep 17 00:00:00 2001 From: Graham Krizek Date: Thu, 24 Jan 2019 00:11:22 -0600 Subject: [PATCH] Create a main function for the server --- ghi/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ghi/server.py b/ghi/server.py index 347fb93..ce79e96 100644 --- a/ghi/server.py +++ b/ghi/server.py @@ -35,6 +35,7 @@ def GetArgs(): def InvokeFunction(payload): + sys.path.append(os.path.dirname(os.path.realpath(__file__))) from index import handler return handler(payload) @@ -143,7 +144,7 @@ def ShutDown(signum, frame): exit(0) -if __name__ == "__main__": +def main(): try: # Handle logging ourselves logging.getLogger('tornado.access').disabled = True @@ -154,4 +155,8 @@ def ShutDown(signum, frame): logging.info("server listening on %s" % port) tornado.ioloop.IOLoop.current().start() except KeyboardInterrupt: - ShutDown(None, None) \ No newline at end of file + ShutDown(None, None) + + +if __name__ == "__main__": + main() \ No newline at end of file