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

I see nothing wrong with this?

This looks like a glitch because I dont't any issues here. Am I missing something?

initialize.py
from peewee import *


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

    class Meta:
        database = db



db = SqliteDatabase('challenges.db')

nvm I got it taking care of.

1 Answer

Christopher Shaw
Christopher Shaw
Python Web Development Techdegree Graduate 49,831 Points

I am assuming from your comment that you worked it out. For interest sake of anyone searching for a similar problem,

db = SqliteDatabase('challenges.db') should be placed before class Challenge(Model):