Esempio n. 1
0
def create_user(conn):
    c = conn.cursor()
    salt = crypto.get_random_string()
    enpass = crypto.hex_password(PASSWORD)
    c.execute("""
        INSERT INTO users ( salt, username, password, email) VALUES (?,?,?,?)
        """, (salt, USERNAME, enpass, EMAIL))
    conn.commit()
Esempio n. 2
0
def create_user(conn):
    c = conn.cursor()
    salt = crypto.get_random_string()
    enpass = crypto.hex_password(PASSWORD)
    c.execute(
        """
        INSERT INTO users ( salt, username, password, email) VALUES (?,?,?,?)
        """, (salt, USERNAME, enpass, EMAIL))
    conn.commit()
Esempio n. 3
0
             salt VARCHAR(12) NOT NULL, username VARCHAR(50) NOT NULL,
             password VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL);
          """)
c.execute("""CREATE TABLE posts (id INTEGER NOT NULL PRIMARY KEY,
             title VARCHAR(100) NOT NULL, slug VARCHAR(100) NOT NULL,
             content TEXT NOT NULL, tags VARCHAR(255) NOT NULL,
             category VARCHAR(30) NOT NULL, published VARCHAR(30) NOT NULL);
          """)
c.execute("""CREATE TABLE tags (id INTEGER NOT NULL PRIMARY KEY,
             name VARCHAR(50) NOT NULL, post_id INTEGER NOT NULL);
          """)

c.execute("CREATE UNIQUE INDEX users_id ON users(id);")
c.execute("CREATE UNIQUE INDEX posts_id ON posts(id);")
c.execute("CREATE INDEX posts_slug ON posts(slug);")
c.execute("CREATE INDEX tags_name ON tags(name);")
c.execute("CREATE UNIQUE INDEX tags_id ON tags(id);")

print "Start Create User........."

salt = crypto.get_random_string()
enpass= crypto.hex_password(password)

c.execute("INSERT INTO users ( salt, username, password, email) VALUES (?,?,?,?)",
          (salt, username, enpass, email))

conn.commit()
conn.close()

print "DB Create.......!!"