Created
February 16, 2011 01:03
-
-
Save amites/828636 to your computer and use it in GitHub Desktop.
Simple script to clear database sessions in a django project.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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