default_console_logger.setFormatter(logging_format) # Uncomment to log to file (Comment out for GCP) file_logger = logging.FileHandler('app-engine-zxsh.log') file_logger.setFormatter(logging_format) root_logger.addHandler(file_logger) ################################################################################ # Main function ################################################################################ if __name__ == '__main__': # Note: This is used when running locally only. # When deploying to Google App Engine, a webserver process such as Gunicorn will serve the app. # This can be configured by adding an `entrypoint` to app.yaml (to run under uwsgi). # Flask's development server will automatically serve static files in the "static" directory. See: # http://flask.pocoo.org/docs/1.0/quickstart/#static-files. # Once deployed, App Engine itself will serve those files as configured in app.yaml. # from modules import app_version # app_version.incr_revision() from datetime import datetime logging.info("[PROGRAM START]") logging.critical("%8s test message %s" % ("CRITICAL", str(datetime.utcnow()))) logging.error("%8s test message %s" % ("ERROR", str(datetime.utcnow()))) logging.warning("%8s test message %s" % ("WARNING", str(datetime.utcnow()))) logging.info("%8s test message %s" % ("INFO", str(datetime.utcnow()))) logging.debug("%8s test message %s" % ("DEBUG", str(datetime.utcnow()))) app.run(host='127.0.0.1', port=8080, debug=True)
################################################################################ # Main function ################################################################################ import os if __name__ == '__main__': logging.info("[PROGRAM START]") print_test_log() # TODO: Move this elsewhere (runtime?) # TODO: Make the host, port and debug from the below to be configurable # Use SSL if conditions are right if 'use_ssl' in app_config['runtime'] \ and app_config['runtime']['use_ssl'] == True \ and 'ssl' in app_config \ and 'crt_file' in app_config['ssl'] \ and app_config['ssl']['crt_file'] != None \ and os.path.exists(app_config['ssl']['crt_file']) \ and 'pvk_file' in app_config['ssl'] \ and app_config['ssl']['pvk_file'] != None \ and os.path.exists(app_config['ssl']['pvk_file']): crt_file = app_config['ssl']['crt_file'] pvk_file = app_config['ssl']['pvk_file'] app.run(host='127.0.0.1', port=8080, debug=True, ssl_context=(crt_file, pvk_file)) app.run(host='127.0.0.1', port=8080, debug=True, ssl_context=None) logging.info("[PROGRAM END]")
# Uncomment to log to file (Comment out for GCP) file_logger = logging.FileHandler('plato-hci.log') file_logger.setFormatter(logging_format) root_logger.addHandler(file_logger) ################################################################################ # Main function ################################################################################ if __name__ == '__main__': # Note: This is used when running locally only. # When deploying to Google App Engine, a webserver process such as Gunicorn will serve the app. # This can be configured by adding an `entrypoint` to app.yaml (to run under uwsgi). # Flask's development server will automatically serve static files in the "static" directory. See: # http://flask.pocoo.org/docs/1.0/quickstart/#static-files. # Once deployed, App Engine itself will serve those files as configured in app.yaml. # from modules import app_version # app_version.incr_revision() from datetime import datetime logging.info("[PROGRAM START]") logging.critical("%8s test message %s" % ("CRITICAL", str(datetime.utcnow()))) logging.error("%8s test message %s" % ("ERROR", str(datetime.utcnow()))) logging.warning("%8s test message %s" % ("WARNING", str(datetime.utcnow()))) logging.info("%8s test message %s" % ("INFO", str(datetime.utcnow()))) logging.debug("%8s test message %s" % ("DEBUG", str(datetime.utcnow()))) app.run(host='127.0.0.1', port=33040, debug=True)