From 3ddeb3c5d666465e5568500bad037b6164a62385 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Mon, 19 Apr 2021 14:57:59 -0400 Subject: [PATCH] flask websource stuff --- webSource_module.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/webSource_module.py b/webSource_module.py index 4bcf5fa..9e9a508 100644 --- a/webSource_module.py +++ b/webSource_module.py @@ -5,6 +5,7 @@ import time import config as config import db import tts +import threading from flask import Flask @@ -26,8 +27,9 @@ class webSource_Module(): super().__init__() self.dbCredential: credentials.DB_Credential - def main(self): - self.webSources.run(host="0.0.0.0") + def main(self, port_=5000): + print("starting up on port: ", port_) + self.webSources.run(host="0.0.0.0", port= port_) @webSources.route('/') def hello_world(): @@ -38,18 +40,30 @@ class webSource_Module(): tempModule = chyron_module.Chyron_Module() return tempModule.getChyronFile() - @webSources.route('/' + 'brb') - def textSource_tempText(): + @webSources.route('/temptext//') + def textSource_tempText(filename): + print("trying file: ", filename) tempModule = tempText_Module.tempText_Module() - return tempModule.getTempTextFile("brb") + return tempModule.getTempTextFile(filename) if __name__ == "__main__": testModule = webSource_Module() + testModule_2 = webSource_Module() + threads = [] - credentials_manager = credentials.Credentials_Module() - credentials_manager.load_credentials() - testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname) + #credentials_manager = credentials.Credentials_Module() + #credentials_manager.load_credentials() + #testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname) - testModule.main() \ No newline at end of file + thread_ = threading.Thread(target=testModule.main(port_=5000)) + threads.append(thread_) + thread_.start() + + thread_2 = threading.Thread(target=testModule_2.main(port_=8000)) + threads.append(thread_2) + thread_2.start() + + for t in threads: + t.join() \ No newline at end of file