Say you want to do something periodically that will affect your django environment (like check email). You can schedule a task to do that using cron. But that task needs to be run within your django environment.
One way to do that is to use
python manage.py shell < script.py
(or, if you have your permissions altered via chmod +x,
./manage.py shell < script.py
)
It works.
If you want to get fancier, you can make a custom command for manage.py:
https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
Recursive algorithms can be slow because they end up solving the same little problems over and over again. To speed them up, you can use a technique called "memoization." Memoization allows algorithms go much more quickly by remembering solutions to problems they have already solved. I’m the recursive algorithm. This blog is my memoization.
Showing posts with label custom commands. Show all posts
Showing posts with label custom commands. Show all posts
Thursday, November 20, 2014
Subscribe to:
Posts (Atom)