CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels.layers.InMemoryChannelLayer'
}
}
CHANNEL_LAYERS = {
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
"hosts": [('redis', 6379)],
},
},
}
while True засунуть в отдельный поток
def main():
while 1:
for i in Profiles.objects.all():
current = time.time()
current = str(current).split(".")[0]
period_time = int(i.unix_date) + (int(i.period) * 60) * 60
if period_time < int(current):
period(start_profil=i)
current = time.time()
current = str(current).split(".")[0]
Profiles.objects.filter(name=i).update(unix_date=int(current))
time.sleep(1000)
a = Thread(target=main)
a.start()