Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Using Databases in Python Meet Peewee Modeling

Liviu Cucerenco
Liviu Cucerenco
8,039 Points

Problem with [Student]

Hello, I doing the work in this course on the PyCharm IDE. Unfortunately, the line: 'db.create_tables([Student], safe=True)' does not compile. Specifically, it underlines '[Student]' and says "Unresolved reference 'Student'". Consequently, it does not create the Student table in the database. I wonder if anyone could suggest a solution? Thank you for your time.

Cheo R
Cheo R
37,150 Points

Hello Liviu, have you tried doing migrations and migrate? You may have forgotten to add your changes to your models.

1 Answer

Liviu Cucerenco
Liviu Cucerenco
8,039 Points

Thank you for your suggestion. I actually resolved the issue. It was an indentation problem - the if block fell under the class block, so it was confused. As I am new in Python, my problems tend to be caused by silly mistakes. Thank you for taking the time to address my question though.