vision-career/vacancies/main/management/commands/runbot.py

20 lines
565 B
Python

import sys
import asyncio
from django.core.management import BaseCommand
from vacancies.main.bot import application
from langgraph.checkpoint.postgres import PostgresSaver
from vacancies.conf.settings import DB_URI
class Command(BaseCommand):
help = "Run bot"
def handle(self, *args, **options):
with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
checkpointer.setup()
if sys.platform == "win32":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
application.run_polling()