Python Using Databases in Python Our Diary App Doing Data Entry

Script is creating two .db files

My script is creating a diary.db and a peewee.db file, but only putting tables into peewee.db. I have rm -r on the dbs and tried it locally on my own machine with the same effect. script does not do this.

import datetime

from peewee import *

db = SqliteDatabase('diary.db')

class Entry(Model):
  content = TextField()
  timestamp = DateTimeField(

def initialize():
  """Create the database and the table if the don't exist."""
  db.create_tables([Entry], safe=True)

class Meta:
  database = db

def menu_loop():
  """Show the menu"""

def add_entry():
  """Add an entry"""

def view_entries():
  """View previous entries"""

def delete_entry(entry):
  """Delete an entry"""

if __name__ == '__main__':

1 Answer

Kenneth Love
Kenneth Love
Treehouse Guest Teacher

Your class Meta isn't in your class Entry.