Skip to content

Instantly share code, notes, and snippets.

@davidwtbuxton
Created July 21, 2025 09:08
Show Gist options
  • Save davidwtbuxton/46a511b6a7e64df5536922c7e4d35dca to your computer and use it in GitHub Desktop.
Save davidwtbuxton/46a511b6a7e64df5536922c7e4d35dca to your computer and use it in GitHub Desktop.
App Engine standard + Python redirect app
runtime: python313
handlers:
- url: /.*
script: auto
secure: always
automatic_scaling:
max_instances: 1
import http
def app(environ, start_response):
"""Respond with a page or redirect or something for any request."""
status = http.HTTPStatus.FOUND
response_status = f"{status.value} {status.phrase}"
headers = [
("Content-type", "text/html; charset=utf-8"),
("Location", "https://www.google.com/"),
]
start_response(response_status, headers)
return [b""]
if __name__ == "__main__":
import wsgiref.simple_server
with wsgiref.simple_server.make_server("", 8000, app) as server:
server.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment