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 Build a Social Network with Flask How to Win Friends Show Follower Posts

Iwan Engelbrecht
Iwan Engelbrecht
9,941 Points

Errors

I know python, but I've not taken this course. The key problem is your database doesn't have the post table. Could you need to call create_tables somewhere?

2 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,722 Points

upvote for Myers answer -- You need to initialize database tables before these can be accessed.

Also, I am a little wary of the Python that is distributed by Anaconda. It is tuned for higher speed numerical calculations and comes pre-packaged with machine learning and statistical libraries (where it really shines). But potentially Anaconda's Python give some problems as you need to add on Flask packages via pip. You will want to install the Python from Python.org and take some time to learn about virtual environments and it will save you a ton of headaches associated with the installation of packages.

Jeff Muday : Tell me about Anaconda and Flash not working well together. I did a quick google search and didn't see anything about those conflicting. Also, I've been using Pipenv in my most recent projects. Have you given that a spin?

Jeff Muday
Jeff Muday
Treehouse Moderator 28,722 Points

In reality, it is not Flask per se, but that several of Treehouse courses presented by Kenneth Love (on Flask), are taught using the Peewee ORM. This is problematic because several recent versions of Anaconda will throw an error during installation.

Anaconda 2

pip install peewee

Command "C:\ProgramData\Anaconda2\python.exe -u -c "import setuptools, tokenize;file='c:\users\jeffrey\appdata\local\temp\pip-build-8tflwa\peewee\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record c:\users\jeffrey\appdata\local\temp\pip-vyjsop-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\jeffrey\appdata\local\temp\pip-build-8tflwa\peewee\

Anaconda 3

pip install peewee

has similar results.

Of course, there's always SQLAlchemy which comes "built in" to Anaconda. But why rewrite Kenneth's excellent course! Just install Python, learn a little about virtualenv, pip install, etc. Ultimately, this strategy will better prepare someone for an actual deployment in the Amazon cloud or other server scenarios.