33 lines
952 B
Python
Executable File
33 lines
952 B
Python
Executable File
#!/usr/bin/env python
|
|
'''
|
|
Created on 15.09.2010
|
|
|
|
@author: Sergey Morozov
|
|
'''
|
|
|
|
import MySQLdb, os, sys
|
|
toolsdir = os.path.dirname(__file__)
|
|
if toolsdir == '':
|
|
toolsdir = '.'
|
|
serverdir = toolsdir + os.sep + '..'
|
|
sys.path.append(serverdir)
|
|
sys.path.append(serverdir + os.sep + 'include')
|
|
import config
|
|
|
|
if __name__ == '__main__':
|
|
db = MySQLdb.connect(
|
|
host = config.mysql_server,
|
|
user = config.mysql_user,
|
|
passwd = config.mysql_password,
|
|
db = config.mysql_database,
|
|
port = int(config.mysql_port)
|
|
)
|
|
cursor = db.cursor()
|
|
q = "CREATE TABLE IF NOT EXISTS `users` "\
|
|
"(`email` VARCHAR( 40 ) NOT NULL, "\
|
|
"`password` VARCHAR( 40 ) NOT NULL, "\
|
|
"`jsondata` TEXT NOT NULL, "\
|
|
"`pwkey` VARCHAR( 20 ) NULL, "\
|
|
"PRIMARY KEY ( `email` ))"
|
|
cursor.execute(q)
|