summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authoreliott <eliott@cactuswax.net>2007-11-03 03:45:10 -0400
committereliott <eliott@cactuswax.net>2007-11-03 03:45:10 -0400
commit39a548fd2629f3b6383990264b2e331b3aea99fb (patch)
treef68c3156dad5f7814473ceff2461679ddf11a2e8 /scripts
Initial import for public release...
Special Note Prior to git import, approx 90% of the code was done by Judd Vinet. Thanks Judd!
Diffstat (limited to 'scripts')
-rw-r--r--scripts/daily_cleanup.py14
-rwxr-xr-xscripts/djangoshell.sh6
2 files changed, 20 insertions, 0 deletions
diff --git a/scripts/daily_cleanup.py b/scripts/daily_cleanup.py
new file mode 100644
index 00000000..98f997bf
--- /dev/null
+++ b/scripts/daily_cleanup.py
@@ -0,0 +1,14 @@
+from django.db import backend, connection, transaction
+""" Daily cleanup file
+ This purges the session data that is old from the session table.
+"""
+def clean_up():
+ # Clean up old database records
+ cursor = connection.cursor()
+ cursor.execute("DELETE FROM %s WHERE %s < NOW()" % \
+ (backend.quote_name('django_session'), backend.quote_name('expire_date')))
+ cursor.execute("OPTIMIZE TABLE %s" % backend.quote_name('django_session'))
+ transaction.commit_unless_managed()
+
+if __name__ == "__main__":
+ clean_up()
diff --git a/scripts/djangoshell.sh b/scripts/djangoshell.sh
new file mode 100755
index 00000000..457c8827
--- /dev/null
+++ b/scripts/djangoshell.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+cd /home/sites/archlinux/archlinux
+export PYTHONPATH=/usr/local/django:/home/sites/archlinux:${PYTHONPATH}
+export DJANGO_SETTINGS_MODULE=archlinux.settings
+python manage.py $*
+