flask websource stuff
This commit is contained in:
parent
97ded4d153
commit
3ddeb3c5d6
@ -5,6 +5,7 @@ import time
|
|||||||
import config as config
|
import config as config
|
||||||
import db
|
import db
|
||||||
import tts
|
import tts
|
||||||
|
import threading
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
@ -26,8 +27,9 @@ class webSource_Module():
|
|||||||
super().__init__()
|
super().__init__()
|
||||||
self.dbCredential: credentials.DB_Credential
|
self.dbCredential: credentials.DB_Credential
|
||||||
|
|
||||||
def main(self):
|
def main(self, port_=5000):
|
||||||
self.webSources.run(host="0.0.0.0")
|
print("starting up on port: ", port_)
|
||||||
|
self.webSources.run(host="0.0.0.0", port= port_)
|
||||||
|
|
||||||
@webSources.route('/')
|
@webSources.route('/')
|
||||||
def hello_world():
|
def hello_world():
|
||||||
@ -38,18 +40,30 @@ class webSource_Module():
|
|||||||
tempModule = chyron_module.Chyron_Module()
|
tempModule = chyron_module.Chyron_Module()
|
||||||
return tempModule.getChyronFile()
|
return tempModule.getChyronFile()
|
||||||
|
|
||||||
@webSources.route('/' + 'brb')
|
@webSources.route('/temptext/<filename>/')
|
||||||
def textSource_tempText():
|
def textSource_tempText(filename):
|
||||||
|
print("trying file: ", filename)
|
||||||
tempModule = tempText_Module.tempText_Module()
|
tempModule = tempText_Module.tempText_Module()
|
||||||
return tempModule.getTempTextFile("brb")
|
return tempModule.getTempTextFile(filename)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
testModule = webSource_Module()
|
testModule = webSource_Module()
|
||||||
|
testModule_2 = webSource_Module()
|
||||||
|
threads = []
|
||||||
|
|
||||||
credentials_manager = credentials.Credentials_Module()
|
#credentials_manager = credentials.Credentials_Module()
|
||||||
credentials_manager.load_credentials()
|
#credentials_manager.load_credentials()
|
||||||
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
#testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
|
|
||||||
testModule.main()
|
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()
|
||||||
Loading…
Reference in New Issue
Block a user