app/django/bin/daily_cleanup.py
changeset 323 ff1a9aa48cfd
parent 54 03e267d67478
--- a/app/django/bin/daily_cleanup.py	Tue Oct 14 12:36:55 2008 +0000
+++ b/app/django/bin/daily_cleanup.py	Tue Oct 14 16:00:59 2008 +0000
@@ -7,14 +7,7 @@
 sessions at the moment).
 """
 
-import datetime
-from django.db import transaction
-from django.contrib.sessions.models import Session
-
-def clean_up():
-    """Clean up expired sessions."""
-    Session.objects.filter(expire_date__lt=datetime.datetime.now()).delete()
-    transaction.commit_unless_managed()
+from django.core import management
 
 if __name__ == "__main__":
-    clean_up()
+    management.call_command('cleanup')