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.
What's wrong with my view (app.route) . I don't understand why it isn't running the third task properly. Thanks!
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Hello Flask" if __name__ == '__main__': app.run(debug=True, host='0.0.0.0', port=8000)
The tester for that challenge is just too particular (kind of a 'biatch, in my book LOL)!?!
I had to do boatload of trial-n- error to get it right!
The "Bummer" hints are not very helpful in this challenge.
Sometimes I have NO IDEA what the challenge is asking for until I get it right or look up the answer somewhere else (or consult the forums, like you did).
Syntax is generally so arbitrary that I can't understand much of it without seeing several correct/exact examples.
Without many great/accurate examples, many tutorials are useless. A lot leave out critical details without which you can't code it correctly. For example, I took the OWASP course, which was good. but it's missing a lot of critical details about how to implement it - they show a lot of code samples, but not where it goes. (On the client? On the server? In which file? Do I have to do it? Or do I have to involve my hosting provider's tech support, etc.?!? It can get very frustrating.) Unfortunately, I usually have to consult copious 3rd-part resources to fully grasp much of the material.
This passes all three:
from flask import Flask app = Flask(__name__) @app.route('/') def index(): return "Hello Flask" if __name__ == '__main__': app.run(host='0.0.0.0', port=8000)
The double spacing between lines helped as did not putting dunder name in quotes!?!
Like this (you had it right):
__name__ instead of '__name__'
I also got rid of "debug=True" in the app.run statement.
I hope that helps.
Stay safe and happy coding!