GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python-cloud/app.py at main · Eerth/python-cloud Expand file tree/ Copy pathapp.pyMore file actions 43 lines (27 loc) · 1.04 KB / Copy pathapp.pyFile metadata and controls43 lines (27 loc) · 1.04 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 import signal import sys from types import FrameType from flask import Flask, Response, send_from_directory from utils.logging import logger app = Flask(__name__) @app.route("/") def hello() -> Response: # Use basic logging with custom fields logger.info(logField="custom-entry", arbitraryField="custom-entry") # https://cloud.google.com/run/docs/logging#correlate-logs logger.info("Child logger with trace Id.") return send_from_directory('static', 'index.html') def shutdown_handler(signal_int: int, frame: FrameType) -> None: logger.info(f"Caught Signal {signal.strsignal(signal_int)}") from utils.logging import flush flush() # Safely exit program sys.exit(0) if __name__ == "__main__": # Running application locally, outside of a Google Cloud Environment # handles Ctrl-C termination signal.signal(signal.SIGINT, shutdown_handler) app.run(host="localhost", port=8080, debug=True) else: # handles Cloud Run container termination signal.signal(signal.SIGTERM, shutdown_handler) |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |