FzHUEL/main.py

41 lines
921 B
Python

from flask import Flask
import app_conf
import threading
from web.api.receive import api_receive_bp
from web.page import page_bp
conf = app_conf.conf()
def runapp1():
app1 = Flask(__name__)
app1.register_blueprint(page_bp)
app1.run(
debug=conf.getboolean("server", "debug"),
host=conf.get("server", "host"),
port=conf.get("server", "port-web"),
threaded=conf.getboolean("server", "threaded"),
)
def runapp2():
app2 = Flask(__name__)
app2.register_blueprint(api_receive_bp)
app2.run(
debug=conf.getboolean("server", "debug"),
host=conf.get("server", "host"),
port=conf.get("server", "port-api"),
threaded=conf.getboolean("server", "threaded"),
)
if __name__ == "__main__":
thread1 = threading.Thread(target=runapp1)
thread2 = threading.Thread(target=runapp2)
thread1.start()
thread2.start()