Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ from flask import Flask, render_template_string, jsonify
|
|
2 |
from apscheduler.schedulers.background import BackgroundScheduler
|
3 |
import subprocess
|
4 |
import threading
|
|
|
5 |
from datetime import datetime
|
6 |
|
7 |
app = Flask(__name__)
|
@@ -10,7 +11,16 @@ MAX_LOG_ENTRIES = 20
|
|
10 |
|
11 |
def run_cli_script():
|
12 |
"""Runs cli.py and streams logs in real-time to both UI and terminal."""
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
log_entry = {'time': timestamp, 'output': '', 'error': ''}
|
15 |
|
16 |
try:
|
|
|
2 |
from apscheduler.schedulers.background import BackgroundScheduler
|
3 |
import subprocess
|
4 |
import threading
|
5 |
+
import pytz
|
6 |
from datetime import datetime
|
7 |
|
8 |
app = Flask(__name__)
|
|
|
11 |
|
12 |
def run_cli_script():
|
13 |
"""Runs cli.py and streams logs in real-time to both UI and terminal."""
|
14 |
+
|
15 |
+
# Get the current UTC time and convert to IST
|
16 |
+
utc_now = datetime.utcnow()
|
17 |
+
ist_timezone = pytz.timezone("Asia/Kolkata")
|
18 |
+
ist_time = utc_now.replace(tzinfo=pytz.utc).astimezone(ist_timezone)
|
19 |
+
|
20 |
+
# Format the IST time
|
21 |
+
timestamp = ist_time.strftime("%Y-%m-%d %H:%M:%S IST")
|
22 |
+
|
23 |
+
# timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
|
24 |
log_entry = {'time': timestamp, 'output': '', 'error': ''}
|
25 |
|
26 |
try:
|