Reputation: 145
I have a task in django. The Model can be described as Col1,Col2,Col3; all character values. I need to modify my mysql database(The above model), already connected to Django, everyday in the following ways:
The value of col1=col2; and Col2=col3;
The aforesaid task has to be performed in django, everyday.It is a kind of updation I need to perform automatically, before further interactions with the app.
Can any one suggest me a suitable path to achieve so, specifically how do I update my model?
Upvotes: 0
Views: 2080
Reputation: 11879
You could create a management command and run it from a cron job every day.
https://docs.djangoproject.com/en/1.10/howto/custom-management-commands/
Alternately Celery can run scheduled tasks in a cron like fashion, but this takes a fair bit of setting up. It does have the advantage that its done in Django, so if you move servers then you don't need to remember to set up the cron jobs.
Upvotes: 1