Flask Tutorial #2 - HTML Templates

preview_player
Показать описание
In this flask tutorial I will show you how to render and create HTML templates. I will also discuss how to dynamically create HTML with the use of python code in your html files.

◾◾◾◾◾
💻 Enroll in The Fundamentals of Programming w/ Python

◾◾◾◾◾◾

⚡ Please leave a LIKE and SUBSCRIBE for more content! ⚡


Tags:
- Tech With Tim
- Python Tutorials
- Flask Tutorial
- Flask Python HTML Templates
- Flask Python HTML
- Templates Flask

#Python #FlaskPython #Flask
Рекомендации по теме
Комментарии
Автор

so for anyone having issues with this line:
return redirect(url_for("user", name="admin"))

it took me like 2 hours to understand the problem and here it is:


the function /<name> takes the argument name and makes it into a url that will say "Hello name"...
if you put "admin" as the argument the url will basically just redirect to the same url tyhat is defined before ("/admin") and cause it to loop and redirect it to admin again. The toturial didn't specifically mention this but I believe its very important :D

THANKS!

elarvis
Автор

I literally just finished tutorial #1 and was looking to see if #2 was out, and it says "6 minutes ago"


I'm so happy

luka-j-ovanovic
Автор

I was able to make a web app for a work project I was working on because of this video. Thank you.

knj
Автор

And HTML becomes more useful because of Python...

💯💯💯💯

SkyFly
Автор

Extremely useful!! You're the best! It was easy to understand yet powerful. I simply can't wait to see the other videos.

persephassa
Автор

For anyone thinking how to pass context to HTML template as a python dictionary, you can do the following:

# In python
context = {
"name": name,
"age": 27
}
# The same if you do: render_template('index.html', name=name, age=27)
return render_template('index.html', **context)

**variable is a python syntax to populate the key value pairs to key=value like the idea of **kwargs when you want to pass arbitrary number of arguments to methods.

muhammadradwan
Автор

If your render_template is not working, maybe giving you template not found error, make sure the folder which has your index.html file is named "templates" and not "template". Hope this helps.

angel-dine
Автор

Thank you Tim for the tutorial, I very appreciate your hard work to produce quality videos like this for us to learn

khang-jmpm
Автор

keep up bro and make a full responsive website please like this comment guys !!!

mrjax
Автор

Great stuff! Looking forward to more parts!

PeranMe
Автор

hey tim, thanks for explaining this in such an easy way, "l will give you few more examples so that you guys really understand it " takes my heart

mohiitsihag
Автор

I so much appreciate when we can deal with errors in tutorials! :)

KeithFlint
Автор

This part I understood better than the first; coming from php it's easy for me to see the "inline" dynamic language content mixed with the static html code.Thank you Tim.

alerey
Автор

Tim made so many proofs that I'm 100% sure that he hasn't made this up. :)

Awesome video! :)

krystianmasiak
Автор

Finally understand. Best tutorial I've ever seen. thank you.

magorzatag
Автор

For those who're getting a plain white screen in browser while running the render_template with index.html, just save the index.html, then run it.

siddhanthmetla
Автор

In case someone is getting 404 or any error, check in each python expression u have written %} or {% not % } or { %. Spaces giving error

priyalhedau
Автор

Man you're just really the best python teaching youtuber I know

LesterFD
Автор

I'm coming from Django background,
it is very easy for me, and very similar
Thanks Tim

meqdaddev
Автор

Very very thanks bro.
I was suffering from the .html file should be in template folder directory next to the python file for two days.
It was quite frustrating . Thank you.

peace