update script (for cron)

This commit is contained in:
Thomas NOEL 2011-04-21 23:25:07 +02:00
parent 3565ca085c
commit e316b14336
1 changed files with 24 additions and 0 deletions

24
update-ao.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
# virtualenv
import site
site.addsitedir("/home/thomas/surveillao.ve/lib/python2.5/site-packages")
# django init
sys.path.append('/home/thomas/surveillao.ve/')
sys.path.append('/home/thomas/surveillao.ve/surveillao/')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from surveillao.base.models import Feed
for feed in Feed.objects.all():
print 'update', feed,
try:
added = feed.read()
except:
print 'error'
else:
print 'done (%d new items)' % added