File size: 1,103 Bytes
7b7bdab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Hugging Face Spaces FastAPI Debug Toolbar
GitHub Actions自動デプロイ版
"""
import os
import sys

# codespaces_debug.py から app をインポート
try:
    from codespaces_debug import app
    print("✅ FastAPI Debug Toolbar loaded successfully")
except ImportError as e:
    print(f"❌ Failed to import codespaces_debug: {e}")
    # フォールバック用の簡単なFastAPIアプリ
    from fastapi import FastAPI
    from fastapi.responses import HTMLResponse
    
    app = FastAPI(title="FastAPI Debug Toolbar - Error")
    
    @app.get("/")
    async def error_page():
        return HTMLResponse("""
        <!DOCTYPE html>
        <html>
        <head><title>Debug Toolbar Error</title></head>
        <body>
            <h1>❌ Error Loading Debug Toolbar</h1>
            <p>Failed to load codespaces_debug.py</p>
            <p>Check the logs for more details.</p>
        </body>
        </html>
        """)

if __name__ == "__main__":
    import uvicorn
    port = int(os.environ.get("PORT", 8004))
    uvicorn.run(app, host="0.0.0.0", port=port)