Skip to content

Commit

Permalink
Create a main function for the server
Browse files Browse the repository at this point in the history
  • Loading branch information
gkrizek committed Jan 24, 2019
1 parent 07ab048 commit e41bccb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ghi/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -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)
ShutDown(None, None)


if __name__ == "__main__":
main()

0 comments on commit e41bccb

Please sign in to comment.