Started to very slowly do the Mega Flask Tutorial.
This real world project-cum-tutorial, should let me learn more real-world-esque Python and expand beyond the tiny vocabulary, I have.
Setup my environment today and created a baby flask app.
Even that had something to teach me.
I could not quite wrap my head around decorators, the first time I read about them and this tiny app uses routes in the form of decorators.
Which meant, I had to go read about them and understand them first.
Routes are paths.
And decorators are something (a function/class) that take your existing code and enclose it, whilst giving it extra functionality.
In my case, my code just printed a line.
And the route decorators, in my case, took that code and assigned it to a web page of my choosing.
Right now the home page is assigned to that line.
And if I choose to, I could assign any other url to that same line.
This was hard, but fun.
Looking to do more of this slow steady work over the coming weeks.
from Planet Python
via read more
No comments:
Post a Comment