add database.py and finish database initialzing function.