Spaces:
Sleeping
Sleeping
ichieh commited on
Commit ·
902108d
1
Parent(s): 5fb5209
fix: 修正 current_app 的使用問題
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
from flask import Flask, render_template, request, jsonify, session, redirect, url_for
|
| 2 |
from flask_sqlalchemy import SQLAlchemy
|
| 3 |
from datetime import datetime, timedelta
|
| 4 |
import os
|
|
@@ -289,14 +289,14 @@ def update_settings():
|
|
| 289 |
|
| 290 |
try:
|
| 291 |
response = requests.post(
|
| 292 |
-
|
| 293 |
json=settings_data,
|
| 294 |
timeout=10
|
| 295 |
)
|
| 296 |
if not response.ok:
|
| 297 |
-
|
| 298 |
except Exception as e:
|
| 299 |
-
|
| 300 |
|
| 301 |
return jsonify({'message': '設定已更新'})
|
| 302 |
except Exception as e:
|
|
|
|
| 1 |
+
from flask import Flask, render_template, request, jsonify, session, redirect, url_for, current_app
|
| 2 |
from flask_sqlalchemy import SQLAlchemy
|
| 3 |
from datetime import datetime, timedelta
|
| 4 |
import os
|
|
|
|
| 289 |
|
| 290 |
try:
|
| 291 |
response = requests.post(
|
| 292 |
+
app.config['SETTINGS_SCRIPT_URL'],
|
| 293 |
json=settings_data,
|
| 294 |
timeout=10
|
| 295 |
)
|
| 296 |
if not response.ok:
|
| 297 |
+
app.logger.error(f"Failed to sync settings to Google Sheets: {response.text}")
|
| 298 |
except Exception as e:
|
| 299 |
+
app.logger.error(f"Error syncing settings to Google Sheets: {str(e)}")
|
| 300 |
|
| 301 |
return jsonify({'message': '設定已更新'})
|
| 302 |
except Exception as e:
|