'Django ASGI schedule stuck after While True

After I add this lines, following the schedule docs example, my server stucks and I cant even kill it with ctrl + C, the code is at the very bottom of my app views.py, where should I be adding this while loop command?

schedule.every(30).seconds.do(getEvents)
while True:
    schedule.run_pending()
    time.sleep(1)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source