-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.py
27 lines (23 loc) · 1.01 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import uvicorn
from config.config import config
import os
import asyncio
import threading
import uvicorn
from config.config import config
import os
from app.server import init_queue
if __name__ == "__main__":
os.environ["ENV"] = config.ENV # uygulama çalıştırılırken parametre olarak girilmesi sağlanıp,
os.environ["DEBUG"] = str(True if config.ENV != "production" else False)
t1 = threading.Thread(target=uvicorn.run, args=("app.server:app",), kwargs={"host": config.APP_HOST,
"port": config.APP_PORT,
"timeout_keep_alive":
config.MICROSERVICE_CLIENT_TIMEOUT})
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
t2 = threading.Thread(target=loop.run_until_complete, args=(init_queue(),))
t1.start()
t2.start()
t1.join()
t2.join()