Python Forum
Displaying search results
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Displaying search results
#14
Like I told you, figure out how to do templating. I figure that the problem of writing this web app is quite big for you and you're not able to break it down into small pieces. When you started programming, did you write a program that asked a user's name and then greeted them (e.g. if you entered "Alice", it would say "Hello, Alice", or if you entered "Bob", it would say "Hello, Bob")? If you haven't written web apps before, I'd basically start with doing the web app version of that - getting that string displayed in a browser. The templating example in the Flask docs does exactly that. Trying to do too many things at once just leads to confusion I think.

(Jun-16-2020, 06:36 AM)card51shor Wrote: I've just been teaching myself by trying to figure out this project.

What I was getting at really is that your way of learning seems to be very unstructured and you're missing key knowledge because of that. The fact that you don't understand why templating is necessary (see below) is a sign.

Quote:Why would I need variables in the HTML? I already have the data that I need in the variable "b" in python. I just want to print out the values for the users to see from the search.

Think about it: your search query is already reasonably complex. One user might search for "Refactoring", another might search for "Kent Beck" and the possibilities are endless. You just can't have static pages to take care of all those possibilities, so the pages that the browser gets need to be dynamically created. OK, so the first way to do that is just by using string concatenation (or interpolation) to make the structure of the page and insert the data in the right places. Of course, you'd be using variables there. Nobody really does it this way any more, not least because it doesn't scale. We use templates these days, which again make use of variables to put the data in the right places. It's a better approach also because you separate how you get the data (and whatever calculations, transformations, etc. you need to do on it) from how it's presented to the user. Separation of concerns is really important in software - it helps to allow you to change one thing without affecting the other.
Reply


Messages In This Thread
Displaying search results - by card51shor - Jun-16-2020, 05:37 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 06:04 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:06 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 06:14 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:19 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 06:20 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:23 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 06:24 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:26 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 06:29 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:36 AM
RE: Displaying search results - by buran - Jun-16-2020, 06:49 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 06:54 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 07:11 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 07:20 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 07:28 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 07:34 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 07:44 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 07:58 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 08:34 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 03:29 PM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 08:01 PM
RE: Displaying search results - by card51shor - Jun-16-2020, 08:36 PM
RE: Displaying search results - by card51shor - Jun-17-2020, 12:41 AM
RE: Displaying search results - by SheeppOSU - Jun-16-2020, 07:40 AM
RE: Displaying search results - by card51shor - Jun-16-2020, 07:51 AM
RE: Displaying search results - by ndc85430 - Jun-16-2020, 07:56 AM
RE: Displaying search results - by buran - Jun-16-2020, 07:50 AM
RE: Displaying search results - by buran - Jun-16-2020, 07:56 AM
RE: Displaying search results - by SheeppOSU - Jun-16-2020, 08:37 AM
RE: Displaying search results - by pyzyx3qwerty - Jun-16-2020, 04:26 PM
RE: Displaying search results - by pyzyx3qwerty - Jun-17-2020, 02:01 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 02:41 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 04:35 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 05:18 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 05:29 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 05:41 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 05:42 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 05:51 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 06:18 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 06:32 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 06:33 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 06:35 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 06:43 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 06:44 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 07:28 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 07:38 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 07:49 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 07:55 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 08:06 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 08:12 AM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 08:15 AM
RE: Displaying search results - by card51shor - Jun-17-2020, 08:18 AM
RE: Displaying search results - by SheeppOSU - Jun-17-2020, 03:22 PM
RE: Displaying search results - by card51shor - Jun-17-2020, 04:04 PM
RE: Displaying search results - by ndc85430 - Jun-17-2020, 05:29 PM
RE: Displaying search results - by card51shor - Jun-17-2020, 05:44 PM
RE: Displaying search results - by ndc85430 - Jun-18-2020, 04:23 AM
RE: Displaying search results - by card51shor - Jun-18-2020, 04:54 AM
RE: Displaying search results - by ndc85430 - Jun-18-2020, 05:01 AM
RE: Displaying search results - by card51shor - Jun-18-2020, 05:33 AM
RE: Displaying search results - by ndc85430 - Jun-18-2020, 05:43 AM
RE: Displaying search results - by card51shor - Jun-18-2020, 05:52 AM
RE: Displaying search results - by ndc85430 - Jun-18-2020, 05:56 AM
RE: Displaying search results - by card51shor - Jun-18-2020, 05:58 AM
RE: Displaying search results - by ndc85430 - Jun-18-2020, 05:59 AM
RE: Displaying search results - by card51shor - Jun-18-2020, 06:35 AM
RE: Displaying search results - by ndc85430 - Jun-19-2020, 05:40 AM
RE: Displaying search results - by card51shor - Jun-19-2020, 07:01 AM
RE: Displaying search results - by card51shor - Jun-19-2020, 09:59 PM
RE: Displaying search results - by ndc85430 - Jun-20-2020, 05:47 AM
RE: Displaying search results - by card51shor - Jun-20-2020, 07:43 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 12:38 AM
RE: Displaying search results - by ndc85430 - Jun-21-2020, 05:06 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 05:25 AM
RE: Displaying search results - by ndc85430 - Jun-21-2020, 05:44 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 05:45 AM
RE: Displaying search results - by ndc85430 - Jun-21-2020, 05:47 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 05:48 AM
RE: Displaying search results - by ndc85430 - Jun-21-2020, 05:56 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 06:00 AM
RE: Displaying search results - by ndc85430 - Jun-21-2020, 06:00 AM
RE: Displaying search results - by card51shor - Jun-21-2020, 06:08 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020