App Engine Python SDK version 1.9.12
[gae.git] / python / lib / django-0.96 / django / bin / daily_cleanup.py
blob3b83583d73ee27a29a2089f32f5720138bc88d00
1 #!/usr/bin/env python
3 """
4 Daily cleanup job.
6 Can be run as a cronjob to clean out old data from the database (only expired
7 sessions at the moment).
8 """
10 from django.db import backend, connection, transaction
12 def clean_up():
13 # Clean up old database records
14 cursor = connection.cursor()
15 cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
16 (backend.quote_name('django_session'), backend.quote_name('expire_date')))
17 transaction.commit_unless_managed()
19 if __name__ == "__main__":
20 clean_up()