Jun-17-2020, 07:49 AM
(Jun-17-2020, 07:38 AM)card51shor Wrote: Yes I know what keyword arguments are and what parameters to a function are. Why is it using this line @app.route('/hello/<name>')? def hello(name=None): Why is name being declared as none as a parameter? So that it just says "Hello World"?
Did you read the section on routing? Did you try the example? What information did you glean from doing those things?
Quote:I just don't see where name is in the paragraph above my first example, which is this :
from flask import request @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': return do_the_login() else: return show_the_login_form()
That's in an entirely different section that describes HTTP methods. Your current question is about rendering templates, so I don't know why you'd go to a different section. By paragraph, I meant the text immediately above the code sample.
Quote:I was experimenting with code last night - i was just getting errors and being frustrated so I just reset to my working code. So now I don't have that. It wasn't anything useful anyways.
I've said this before, but we can't help unless we see your attempts.
Quote:I don't think it applies to my project because it isn't getting a user value that is a list and displaying it on the screen. Most importantly - It's not showing me the HTML.
You need to learn to abstract a bit - the important things are that there is variable data coming from somewhere and that data is being shown on a page. In the example, the data comes from the request path (by the way, paths in URLs don't necessarily relate to a directory structure), but for yours it comes from the database. The two cases are the same in the sense that they're about getting stuff rendered in a template. The HTML is shown - that's what the template is.
Quote:So If I can't understand how to do what I have to do after reading that page 3 times - I should quit? Ask you guys for help? What should I do?
It's really that easy? I'm just totally missing it? All the info I need is right there?
I'm not trying to be snarky, by the way. I honestly want to know - if I still don't get it - am I an idiot? Is it that easy to understand? Most people could read those instructions and know how to start coding what I have to do?
I don't know what to suggest here, other than playing with the examples, trying to change them and work stuff out. Perhaps a forum really isn't the best place for you to get help; I don't know.
Are you saying you weren't taught any of these things in the course? I'd expect a course on web development to explain this stuff.