Spaces:
Sleeping
Sleeping
Deploy Bot commited on
Commit ·
089ce27
1
Parent(s): b28d3f1
Debug React template serving and include built frontend
Browse files- Add debug information to serve_react_app to identify template issues
- Include frontend/dist build files with correct relative paths
- Force add dist/ folder despite .gitignore
backend/core/views.py
CHANGED
|
@@ -162,4 +162,12 @@ def predict_material(request):
|
|
| 162 |
@require_http_methods(['GET'])
|
| 163 |
def serve_react_app(request):
|
| 164 |
"""Serve React app from built index.html"""
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
@require_http_methods(['GET'])
|
| 163 |
def serve_react_app(request):
|
| 164 |
"""Serve React app from built index.html"""
|
| 165 |
+
try:
|
| 166 |
+
return render(request, 'index.html')
|
| 167 |
+
except Exception as e:
|
| 168 |
+
# Debug: return error info
|
| 169 |
+
return HttpResponse(f"Template error: {str(e)}<br>Template dirs: {get_template_engine().dirs if hasattr(get_template_engine(), 'dirs') else 'N/A'}", content_type='text/html')
|
| 170 |
+
|
| 171 |
+
def get_template_engine():
|
| 172 |
+
from django.template import engines
|
| 173 |
+
return engines['django'].engine
|
frontend/dist/assets/index-COYVVSYT.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*{box-sizing:border-box}body{font-family:Arial,sans-serif;background:#f3f4f6;margin:0;padding:20px}.container{max-width:800px;margin:0 auto}header{text-align:center;margin-bottom:20px}.card{background:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 6px #00000014}.input-group{margin-bottom:12px}.input-group label{display:block;font-weight:700;margin-bottom:6px}input[type=number]{width:100%;padding:8px;border:1px solid #ddd;border-radius:4px}button{padding:10px 14px;background:#2563eb;color:#fff;border:none;border-radius:6px;cursor:pointer}button[disabled]{opacity:.6;cursor:not-allowed}.result{margin-top:16px}.error{color:#b91c1c}
|
frontend/dist/assets/index-CloX1ALL.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
frontend/dist/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!doctype html>
|
| 2 |
+
<html>
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>SciANN App</title>
|
| 7 |
+
<script type="module" crossorigin src="./assets/index-CloX1ALL.js"></script>
|
| 8 |
+
<link rel="stylesheet" crossorigin href="./assets/index-COYVVSYT.css">
|
| 9 |
+
</head>
|
| 10 |
+
<body>
|
| 11 |
+
<div id="root"></div>
|
| 12 |
+
</body>
|
| 13 |
+
</html>
|