I usually create management commands and call that. Here's the docs: https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
On Thu, Nov 8, 2012 at 2:41 PM, Andre Lopes <lopes80an...@gmail.com> wrote: > Hi all, > > I need to run a script once a day. The script basically will call a > postgresql function. I've google and I found a solution just like > this. The problem is that does not work. > > [code] > import os > os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' > from myapp.models import * > > MyModelClass.objects.raw("select materialize('some', 't_some_table');") > [/code] > > I've created a file with the code above, but the RAW does not run the > function "materialize". > > There is a better way to call a function using the Django environment? > > > > Best Regards, > > -- > 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 > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.