Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.