from appObj import appObj import os import sys appObj.init(os.environ) expectedNumberOfParams = 0 if ((len(sys.argv) - 1) != expectedNumberOfParams): raise Exception('Wrong number of paramaters passed (Got ' + str((len(sys.argv) - 1)) + " expected " + str(expectedNumberOfParams) + ")") appObj.run()
except: print('uwsgi not availiable') globalFlaskAppObj = appObj.flaskAppObject if __name__ == "__main__": #Custom handler to allow me to use my own logger from werkzeug.serving import WSGIRequestHandler, _log class CustomRequestHandler(WSGIRequestHandler): # Stop logging sucessful health checks #Stops flask logging health checks # dosen't work in container with nginx def log_request(self, code='-', size='-'): ignore = False if code > 199: if code < 300: if "healthcheck=true" in self.requestline: ignore = True if ignore: return return super(CustomRequestHandler, self).log_request(code, size) expectedNumberOfParams = 0 if ((len(sys.argv) - 1) != expectedNumberOfParams): raise Exception('Wrong number of paramaters passed (Got ' + str((len(sys.argv) - 1)) + " expected " + str(expectedNumberOfParams) + ")") appObj.run(CustomRequestHandler)