diff --git a/trafficlightfrontend/apps.py b/trafficlightfrontend/apps.py index 720639f..455502d 100644 --- a/trafficlightfrontend/apps.py +++ b/trafficlightfrontend/apps.py @@ -19,12 +19,12 @@ class TrafficlightfrontendConfig(AppConfig): if TrafficlightfrontendConfig.initialized or os.environ.get("RUN_MAIN") is None: return - print("Traffic Light Frontend: initialization.") - print("Current working directory: {}".format(os.getcwd())) + # print("Traffic Light Frontend: initialization.") + # print("Current working directory: {}".format(os.getcwd())) - periods = json.load(open("periods.json")) + periods = json.load(open(os.path.join(settings.BASE_DIR, settings.SIMULATION_DATA_FILE))) - SimulationThread.initialize(periods, start_time=datetime.time.fromisoformat("07:59"), time_factor=4.0) + SimulationThread.initialize(periods, start_time=datetime.time.fromisoformat(settings.SIMULATION_START_TIME), time_factor=settings.SIMULATION_TIME_FACTOR) SimulationThread.get_instance().start() TrafficlightfrontendConfig.initialized = True diff --git a/trafficlights/settings.py b/trafficlights/settings.py index 2dc214b..224a15c 100644 --- a/trafficlights/settings.py +++ b/trafficlights/settings.py @@ -122,3 +122,8 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +# Simulation-specific settings +SIMULATION_DATA_FILE = 'periods.json' +SIMULATION_START_TIME = '07:59' +SIMULATION_TIME_FACTOR = 4.0