-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
22 lines (17 loc) · 921 Bytes
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# perform required imports
import sqlite3
from contextlib import closing
from getpass import getpass
# set up database connection and create database if not existent
db = sqlite3.connect('wishlist.db')
# create required database tables
db.execute('create table if not exists wishlist (id integer primary key autoincrement, title text not null, text text not null)')
db.execute('create table if not exists users (id integer primary key autoincrement, username text not null, password text not null, email text not null)')
# Create default admin user
username = raw_input("Please create a default admin user: ")
password = getpass("Please set password for default admin user: ")
email = raw_input("Email address for password reset and notifications: ")
db.execute('insert into users (username, password, email) values (?, ?, ?)', (username, password, email))
# Commit changes and close database
db.commit()
db.close()