Answer the question
In order to leave comments, you need to log in
How to start a Django background process?
What is the best way to run background processes in django?
The bottom line is that I have a post on the site, it has a deactivation date, I need to deactivate it in real time at the moment when the end date coincides with the current date or will already be "in the past". Regarding the implementation of background processes in python, I found only this example
import time
from threading import Thread
def timer(name):
count = 0
while True:
time.sleep(60)
count += 1
print("Hi " + name + "This program has now been running for " + str(count) + " minutes.")
print("Hello! Welcome to the program timer!")
name = raw_input("What is your name?")
print("Nice to meet you, " + name + "!")
background_thread = Thread(target=timer, args=(name,))
background_thread.start()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question