0

I want to update DB using Windows Scheduler on a weekly basis. I have the code which extracts the data to be saved as a separate module, so I need to add DB write code there. Is it possible to run it without the server? If not, how to better run a server, make this task only and exit. I write like this now:

e = Employee()
e.profile_link = ...
...
e.save()

models.py:
from django.db import models

class Employee(models.Model):
    profile_link = models.TextField(primary_key=True)
    ...
Cœur
  • 37,241
  • 25
  • 195
  • 267
noname7619
  • 3,370
  • 3
  • 21
  • 26
  • Possible duplicate of [Using django for CLI tool](http://stackoverflow.com/questions/32088702/using-django-for-cli-tool) – e4c5 Sep 05 '16 at 12:56

1 Answers1

1

I would suggest you to write a custom management command and then run it whenever you want.

Take a look at this answer.

Community
  • 1
  • 1
Ernest
  • 2,799
  • 12
  • 28