I try to serve multiple apps with pn.serve. Apps is in the same folder and they are each wrapped in functions separately. Apps get data from database. The issue here is that they fetch data only when server restarts. When I refresh web browser and when there is new data on db, I cant see the updated data. It is as if app is initialized once at startup and no more updating. Thats the main.py:
import panel as pn
import os
from apps import harita,template1
harita = harita.ornekle()
cihaz1 = template1.create('cihaz1')
ROUTES = {
"Tum_Projeler": harita,
"Vitra_Karo_SprayDryer1": cihaz1
}
pn.serve(ROUTES, port=5006)
and here is the head of the code for template1.py:
import numpy as np
import pandas as pd
from statsmodels.tsa.holtwinters import ExponentialSmoothing
from sklearn.metrics import mean_squared_error
import panel as pn
import influxdb_client, os, time, json
from datetime import datetime, timezone
import folium
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
import warnings
warnings.filterwarnings("ignore")
pn.extension(loading_spinner='dots', loading_color='#00aa41')
def create(cihaz_tag):
INFLUXDB_TOKEN="rbQ2hHdTwSIBWZJT4JyvA8MEyuQ0VRkfmXK21CvFCqF1saA1qB6Zaw3WEng_90QaG4fmY4yraxB036ZBdLXkLQ=="
#token = os.environ.get("INFLUXDB_TOKEN")
org = "Sankontrol"
if os.name == 'nt':
influxdb_url = "http://154.53.166.5:8086"
else:
influxdb_url = "http://localhost:8086"