Skip to main content

A Hundred Days of Code, Day 043

Continuing with the Flask course.

Today I learnt about how to loop, using Jinja loop blocks.
The syntax is slowly becoming clear to me.
Everything python related in enclosed is {% … %} blocks, except for variables which use their own {{ … }} syntax.

What I am still confused on is the relationship between the various files, I am writing. There is html and then there are templates and there are python files themselves. Hopefully that will get clearer in the days to come.
My naïve understanding, right now, is

  1. Some native python code is mainly for launching and running the app.
  2. The html templates pull data from …
  3. The flask python code I write (the routes file, as of now).

I also learnt how to extend templates. I created a base template that basically contains the header and the title, which will now be used by every new webpage I build. Right now, it’s just the home page.
I can see a footer or header or some such persistent element that needs to be on every page, that can be created once and then extended multiple times.

More, tomorrow …

P.S. Looking at that finished app, and knowing my extremely rudimentary Python skills, I feel like an apprentice mason, hammer and a chisel in hand, wondering, how in heck, am I going to carve David?