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 trialMadhavi Chakra
111 PointsDatabase error....
When i run code, it says no table called post. Any help? I got code from vid: https://teamtreehouse.com/library/build-a-social-network-with-flask/broadcasting/post-form-and-view
2 Answers
Chris Freeman
Treehouse Moderator 68,441 PointsIt's not clear with seeing your actual code, but it seems that the database has not been initialized for the model Post (hence the table is not yet present).
The course Building a Social Network with Flash is an intermediate course. Have you gone through the prerequisite courses Flask Basics and Using Databases in Python, yet? Unless you already have a good working knowledge of Flask, I recommend completing the prerequisites before moving forward.
Maxwell Hunter
Python Web Development Techdegree Graduate 29,640 PointsI think I know what happened.
when the database is initialized, it only has tables for the Users. you probably need to set it up for Posts too. In models.py, I used this and i seemed to work:
def initialize():
DATABASE.connect()
DATABASE.create_tables([User, Post], safe=True)
DATABASE.close()