As someone mentioned, you'll have to set the DJANGO_SETTINGS_MODULE variable before invoking your python script but remember to add your django project to the Python path as well.
Assuming your project is on a Projects directory this should work (Linux bash): $ export DJANGO_SETTINGS_MODULE=yourproject.settings $ export PYTHONPATH=/home/you/Projects $ python from yourproject.app.models import ModelClass m = ModelClass() ... m.save() xin wrote: > As a part of the application I'm writing I need to do certain things to > the database every night. The easiest way to implement this would be a > python script run every night by cron. > > As django offers an interactive shell (through manage.py) I figured > there must be a way to use this functionality in a simple python > script. > > Does anybody know how to do this? > > thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---