Simple way to run Django, having access to your models, from a cron job/scheduled task or command line.

Place a file into your app directory, alongside, called (for example).

from import setup_environ
import settings

from blog.models import Blog

print Blog.objects.all()

Now, from the same directory, run;


Easy as that. Depending on your setup you may want to add more to your PYTHONPATH or move this file to a different location.

import sys
sys.path.insert(0, '/home/') # top of the list
sys.path.append('/home/domain.dom/my_other_other_code') # bottom of the list