Ensure db connection is closed before script exits

This is required in django 1.4, but was closed automatically back
in 1.2 when it was created.
This commit is contained in:
Magnus Hagander
2013-07-01 22:47:58 +02:00
parent 11fab09c61
commit 7dc9e105f9

View File

@ -13,7 +13,7 @@ import settings
setup_environ(settings)
from core.models import ImportedRSSFeed, ImportedRSSItem
from django.db import transaction
from django.db import transaction, connection
# Set timeout for loading RSS feeds
socket.setdefaulttimeout(20)
@ -49,3 +49,5 @@ for importfeed in ImportedRSSFeed.objects.all():
transaction.commit()
except Exception, e:
print "Failed to load %s: %s" % (importfeed, e)
connection.close()