From cf32a126026e23c82aa9d49e248b24e26de5c71c Mon Sep 17 00:00:00 2001 From: Thomas Grothe Date: Mon, 22 Dec 2025 23:16:17 -0500 Subject: simple python flask webserver from cline (claude 3.7). still unsure about using window.env from html or just an endpoint. --- app.py | 54 ++ css/main.css | 1493 ++---------------------------------------------------- index.html | 10 +- js/main.js | 54 +- requirements.txt | 2 + 5 files changed, 154 insertions(+), 1459 deletions(-) create mode 100644 app.py create mode 100644 requirements.txt diff --git a/app.py b/app.py new file mode 100644 index 0000000..0cb23e9 --- /dev/null +++ b/app.py @@ -0,0 +1,54 @@ +from flask import Flask, render_template, send_from_directory, jsonify +import os + +# Create the Flask application +app = Flask(__name__, + static_folder='.', + static_url_path='') + +# Configuration +class Config: + DEBUG = True + SECRET_KEY = os.environ.get('SECRET_KEY', 'development-key') + # Add more configuration options as needed + +app.config.from_object(Config) + +# Environment variables to pass to frontend +def get_env_vars(): + """Return environment variables to be passed to the frontend""" + return { + 'thing': 1, + # Add more variables as needed + } + +# Routes +@app.route('/') +def index(): + """Serve the main index.html page""" + return send_from_directory('.', 'index.html') + +# API routes - examples for future expansion +@app.route('/api/env') +def api_env(): + """Return environment variables as JSON""" + return jsonify(get_env_vars()) + +@app.route('/api/health') +def health_check(): + """Health check endpoint""" + return jsonify({'status': 'ok'}) + +# Error handlers +@app.errorhandler(404) +def not_found(e): + return jsonify({'error': 'Not found'}), 404 + +@app.errorhandler(500) +def server_error(e): + return jsonify({'error': 'Server error'}), 500 + +if __name__ == '__main__': + # Get port from environment variable or use 5000 as default + port = int(os.environ.get('PORT', 5000)) + app.run(host='0.0.0.0', port=port) diff --git a/css/main.css b/css/main.css index 761657a..daca705 100644 --- a/css/main.css +++ b/css/main.css @@ -1,1450 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - grothedev.github.io/css/home.css at main · grothedev/grothedev.github.io · GitHub - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - -
- Skip to content - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - -
- -
- - - - - - - - -
- - - - - -
- - - - - - - - - -
-
-
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
-
- - - - -
- -
- -
-
- -
- -
-

Footer

- - - - -
-
- - - - - © 2025 GitHub, Inc. - -
- - -
-
- - - - - - - - - - - - - - - - - - - - -
-
-
- - - +body { + font-family: Arial, sans-serif; + margin: 0; + padding: 0; + background-color: #505050; +} +header { + background-color: #333; + color: #dfdfdf; + padding: 1rem; + text-align: center; +} +main { + max-width: 800px; + margin: 2rem auto; + padding: 1rem; + background-color: #cecece; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); +} +section { + margin-bottom: 2rem; +} +section h2 { + margin-top: 0; +} +section p { + margin: 0.5rem 0; +} +section a { + color: #3f6d87; + text-decoration: none; +} +section li { + list-style-type: none; + margin: 1rem 1rem; +} +section a:hover { + text-decoration: underline; +} +.status { + max-width: 800px; + margin: 0 auto; +} diff --git a/index.html b/index.html index 252031d..cd16b50 100644 --- a/index.html +++ b/index.html @@ -10,7 +10,7 @@

.

-
+

@@ -22,7 +22,7 @@
- - -
- +
Server status: Connecting...