Files
setec_cdm/setec-web/wsgi.py
DigiJ 9e839ee826 Initial commit — SETEC LABS Manager (Setec_CDM)
Flask-based VPS management panel with SSH remote command execution.
Includes E2E encrypted SSH tunnel (AES-256-GCM + Go agent), setup wizard,
security hardening tools, DNS management, firewall configs, monitoring,
backup, and .sec patch update system.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 12:39:02 -07:00

54 lines
1.8 KiB
Python

"""Production WSGI entry point — Waitress (Windows) or Gunicorn (Linux)."""
import sys
import os
import config
# Add the setec-web directory to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from app import app
def main():
cfg = config.load()
host = "127.0.0.1"
port = cfg.get("flask_port", 5000)
print(f"SETEC LABS Manager starting on http://{host}:{port}")
print(f"Production WSGI server")
if sys.platform == "win32":
try:
import waitress
print("Using Waitress (Windows)")
waitress.serve(app, host=host, port=port, threads=4)
except ImportError:
print("WARNING: waitress not installed, falling back to Flask dev server")
print("Install with: pip install waitress")
app.run(host=host, port=port, debug=False)
else:
try:
import gunicorn # noqa: F401
print("Using Gunicorn (Linux)")
# For gunicorn, use CLI: gunicorn -w 4 -b 127.0.0.1:5000 wsgi:app
# Fallback to waitress if gunicorn imported but we're not in CLI mode
try:
import waitress
waitress.serve(app, host=host, port=port, threads=4)
except ImportError:
app.run(host=host, port=port, debug=False)
except ImportError:
try:
import waitress
print("Using Waitress (Linux)")
waitress.serve(app, host=host, port=port, threads=4)
except ImportError:
print("WARNING: No production server found, falling back to Flask dev server")
print("Install with: pip install waitress OR pip install gunicorn")
app.run(host=host, port=port, debug=False)
if __name__ == "__main__":
main()