Spaces:
Sleeping
Sleeping
fix
Browse files- app.py +5 -5
- app/app_device_routes.py +3 -3
app.py
CHANGED
@@ -25,9 +25,9 @@ try:
|
|
25 |
# CORS ์ค์
|
26 |
CORS(app, supports_credentials=True)
|
27 |
|
28 |
-
# ์ฅ์น ์๋ฒ URL ํ๊ฒฝ ๋ณ์
|
29 |
-
|
30 |
-
logger.info(f"์ฅ์น ์๋ฒ URL: {
|
31 |
|
32 |
# ์ธ์ฆ ๋ฐ์ฝ๋ ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ
|
33 |
from app.app import login_required
|
@@ -48,8 +48,8 @@ try:
|
|
48 |
return login_required(f)(*args, **kwargs)
|
49 |
return decorated_function
|
50 |
|
51 |
-
# ์ฅ์น ๋ผ์ฐํธ ๋ฑ๋ก
|
52 |
-
register_device_routes(app, device_login_required,
|
53 |
logger.info("์ฅ์น ๋ผ์ฐํธ ์ง์ ๋ฑ๋ก ์ฑ๊ณต")
|
54 |
|
55 |
# 404 ์ค๋ฅ ํธ๋ค๋ฌ ๋ฑ๋ก
|
|
|
25 |
# CORS ์ค์
|
26 |
CORS(app, supports_credentials=True)
|
27 |
|
28 |
+
# ์ฅ์น ์๋ฒ URL ํ๊ฒฝ ๋ณ์ (๋๋ฌธ์๋ก ๋ณ๊ฒฝ)
|
29 |
+
DEVICE_SERVER_URL = os.getenv('DEVICE_SERVER_URL', 'http://localhost:5050')
|
30 |
+
logger.info(f"์ฅ์น ์๋ฒ URL: {DEVICE_SERVER_URL}")
|
31 |
|
32 |
# ์ธ์ฆ ๋ฐ์ฝ๋ ์ดํฐ ๊ฐ์ ธ์ค๊ธฐ
|
33 |
from app.app import login_required
|
|
|
48 |
return login_required(f)(*args, **kwargs)
|
49 |
return decorated_function
|
50 |
|
51 |
+
# ์ฅ์น ๋ผ์ฐํธ ๋ฑ๋ก (๋๋ฌธ์ ๋ณ์๋ช
์ฌ์ฉ)
|
52 |
+
register_device_routes(app, device_login_required, DEVICE_SERVER_URL)
|
53 |
logger.info("์ฅ์น ๋ผ์ฐํธ ์ง์ ๋ฑ๋ก ์ฑ๊ณต")
|
54 |
|
55 |
# 404 ์ค๋ฅ ํธ๋ค๋ฌ ๋ฑ๋ก
|
app/app_device_routes.py
CHANGED
@@ -23,8 +23,8 @@ def register_device_routes(app, login_required, DEVICE_SERVER_URL):
|
|
23 |
timeout = 5 # 5์ด๋ก ํ์์์ ์ค์
|
24 |
|
25 |
try:
|
26 |
-
# ์ฅ์น ์๋ฒ ์ํ ํ์ธ
|
27 |
-
response = requests.get(f"{
|
28 |
|
29 |
if response.status_code == 200:
|
30 |
return jsonify({"success": True, "status": "connected", "data": response.json()})
|
@@ -198,4 +198,4 @@ def register_device_routes(app, login_required, DEVICE_SERVER_URL):
|
|
198 |
return jsonify({
|
199 |
"success": False,
|
200 |
"error": f"ํ๋ก๊ทธ๋จ ์คํ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
201 |
-
}), 500
|
|
|
23 |
timeout = 5 # 5์ด๋ก ํ์์์ ์ค์
|
24 |
|
25 |
try:
|
26 |
+
# ์ฅ์น ์๋ฒ ์ํ ํ์ธ - DEVICE_SERVER_URL ๋ณ์ ์ฌ์ฉ (๋๋ฌธ์)
|
27 |
+
response = requests.get(f"{DEVICE_SERVER_URL}/status", timeout=timeout)
|
28 |
|
29 |
if response.status_code == 200:
|
30 |
return jsonify({"success": True, "status": "connected", "data": response.json()})
|
|
|
198 |
return jsonify({
|
199 |
"success": False,
|
200 |
"error": f"ํ๋ก๊ทธ๋จ ์คํ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
201 |
+
}), 500
|