'How to schedule Django shell command every week?
I'm trying to let a certain Python script run every week in the Django shell. How can I accomplish this? I've read about cron & django-rq, but I don't think this is possible within the given parameters.
Thanks in advance!
PS.: the code in question, it just deletes the old database and adds the updated one:
from formcheck.models import FormCheck
import csv
FormCheck.objects.all().delete()
formcheck_csv = open('PolisCheck.csv', 'r', encoding = "utf-8")
reader = csv.reader(formcheck_csv)
headers = next(reader, None)[1:]
for row in reader:
polis_dict = {}
for h, val in zip(headers, row[1:]):
polis_dict[h] = val
formcheck = FormCheck.objects.create(**polis_dict)
formcheck_csv.close()
exit()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
