Skip to content

Instantly share code, notes, and snippets.

@amites
Created February 16, 2011 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amites/828636 to your computer and use it in GitHub Desktop.
Save amites/828636 to your computer and use it in GitHub Desktop.
Simple script to clear database sessions in a django project.
import MySQLdb
host = 'localhost'
user = 'USER'
passwd = 'PASSWORD'
database = raw_input('Enter database name:')
conn = MySQLdb.connect (host=host, user=user, passwd=passwd, db=database)
cursor = conn.cursor()
cursor.execute ('DELETE FROM django_session')
cursor.close()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment