update
This commit is contained in:
29
app.py
29
app.py
@@ -1,26 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Minimal web app for deployment example."""
|
||||
"""Entry point for Statping clone - HTTP/HTTPS and TCP monitoring."""
|
||||
import os
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
|
||||
PORT = int(os.environ.get("PORT", 8080))
|
||||
VERSION = os.environ.get("VERSION", "dev")
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.send_header("Content-type", "text/html")
|
||||
self.end_headers()
|
||||
self.wfile.write(
|
||||
f"<h1>Hello from Docker!</h1><p>Version: {VERSION}</p>".encode()
|
||||
)
|
||||
|
||||
def log_message(self, format, *args):
|
||||
print(f"[{self.log_date_time_string()}] {format % args}")
|
||||
|
||||
from app.main import app
|
||||
from app.models import init_db
|
||||
from app.scheduler import start_scheduler
|
||||
|
||||
if __name__ == "__main__":
|
||||
server = HTTPServer(("", PORT), Handler)
|
||||
print(f"Server running on port {PORT}")
|
||||
server.serve_forever()
|
||||
init_db()
|
||||
start_scheduler()
|
||||
port = int(os.environ.get("PORT", 8080))
|
||||
app.run(host="0.0.0.0", port=port, debug=False)
|
||||
|
||||
Reference in New Issue
Block a user