问题
I have a model for running the scrapy tasks. Now the view returns scrapped results after some time. There is no any use of two fields search_frequency
and scraping_end_date
for now. This fields will be used to run the scrapy view till the scraping_end_date at the given search_frequency value.
For this problem How can I solve? Which approach will be better ? Is django only will be sufficient for this task? Any suggestions will be helpful.
my model looks like this
class Task(models.Model):
task_status = (
(0, 'running'),
(1, 'running'),
(2, 'completed'),
)
FREQUENCY = (
('1', '1 hrs'),
('2', '2 hrs'),
('5', '5 hrs'),
('10', '10 hrs'),
('24', '24 hrs'),
)
name = models.CharField(max_length=255)
scraping_end_date = models.DateField(null=True, blank=True)
status = models.IntegerField(choices=task_status)
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, blank=True, null=True)
search_frequency = models.CharField(max_length=5, null=True, blank=True, choices=FREQUENCY)
domain = models.URLField()
来源:https://stackoverflow.com/questions/62753171/how-to-run-my-view-periodically-till-some-end-date