Python Using Databases in Python Our Diary App Initialize Database & Create Tables

Emily Strobl
Emily Strobl
5,113 Points

initialize part 3

don't get what im supose to do

initialize.py
from peewee import *
db=SqliteDatabase('challenges.db')

class Challenge(Model):
    name = CharField(max_length=100)
    language = CharField(max_length=100)
    steps = IntegerField(default=1)
    class Meta:
        database=db

1 Answer

Connecting to a database and safely creating a table is shown @5:06 in this video . You just need to put that in a function named initialize