|
|
|
@ -0,0 +1,24 @@
|
|
|
|
|
import pickle
|
|
|
|
|
import sqlite3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_admin():
|
|
|
|
|
"""创建管理员,默认为admin:admin"""
|
|
|
|
|
with open("administrators.pickle", "wb") as fp:
|
|
|
|
|
pickle.dump(("admin", "admin"), fp)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_db():
|
|
|
|
|
"""创建数据库文件,添加表"""
|
|
|
|
|
con = sqlite3.connect("./car_info.db")
|
|
|
|
|
cur = con.cursor()
|
|
|
|
|
cur.execute('create table car(id varchar primary key, name varchar, color varchar, addr varchar, phone int, stay_hours TEXT)')
|
|
|
|
|
con.commit()
|
|
|
|
|
cur.close()
|
|
|
|
|
con.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# create_admin()
|
|
|
|
|
create_db()
|