Example #1
0
File: spsbe.py Project: drulang/sps
def shutdown():
    #NOTE: This method should only be enabled
    #when the application is being tested
    if spsconf.testing:
        func = request.environ.get('werkzeug.server.shutdown')
        if func is None:
            applog.debug("App is not being hosted by werkzeug. Skipping shutting down.")
            msg = {
                "status": "ERR",
                "message": "Not running with werzkeug server"
            }
        else:
            applog.info("Shuting down app server")
            func()
            msg = { "status": "OK" }
        return json.dumps(msg)
    else:
        applog.debug("App not in testing mode. Skipping shuting down server")
        msg = {
            "status": "ERR",
            "message": "Application not in testing mode"
        }
        return json.dumps(msg)
Example #2
0
File: spsbe.py Project: drulang/sps
    if spsconf.testing:
        func = request.environ.get('werkzeug.server.shutdown')
        if func is None:
            applog.debug("App is not being hosted by werkzeug. Skipping shutting down.")
            msg = {
                "status": "ERR",
                "message": "Not running with werzkeug server"
            }
        else:
            applog.info("Shuting down app server")
            func()
            msg = { "status": "OK" }
        return json.dumps(msg)
    else:
        applog.debug("App not in testing mode. Skipping shuting down server")
        msg = {
            "status": "ERR",
            "message": "Application not in testing mode"
        }
        return json.dumps(msg)

if __name__ == "__main__":
    applog.info("Starting dev server")
    applog.info("Port: %s" % spsconf.rest_port)
    applog.info("Debug: %s" % spsconf.debug)
    applog.info("Testing: %s" % spsconf.testing)
    applog.info("No Tokens: %s" % spsconf.notokens)
    app.run(debug=spsconf.debug,
            port=spsconf.rest_port)