Django MySQL Collation Problem

I was having issues with my Django system after i used some default settings to solve them i used this scrip, it updates charset and collate:

#! /usr/bin/env python
import MySQLdb

host = “localhost”
passwd = “urpassword”
user = “urdbuser”
dbname = “urdbname”

db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=dbname)
cursor = db.cursor()

cursor.execute(“ALTER DATABASE `%s` CHARACTER SET ‘utf8’ COLLATE ‘utf8_unicode_ci'” % dbname)

sql = “SELECT DISTINCT(table_name) FROM information_schema.columns WHERE table_schema = ‘%s'” % dbname
cursor.execute(sql)

results = cursor.fetchall()
for row in results:
  sql = “ALTER TABLE `%s` convert to character set DEFAULT COLLATE DEFAULT” % (row[0])
  cursor.execute(sql)
db.close()