Skip to content

Commit 32c2938

Browse files
committed
Static folder included
1 parent 86f8f08 commit 32c2938

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

02.Flask/01.Templates.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def template():
1111
return render_template("index.html")
1212
#file location bydefault templates folder ka hota hai
1313

14+
#static folder ka location use karne ke liye static/filename kar sakte hai
15+
#but instead hum use karte hai url_for('static', filename='fileKAnaam') - best practice
16+
#agar same inline html karna hai to {{}} ke andar use kar sakte hai - check variable.html for more info
17+
1418
#To link python variables to html
1519
@app.route("/variable")
1620
def variable():

02.Flask/static/logo.png

2.39 MB
Loading

02.Flask/templates/variable.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
</head>
99

1010
<body>
11+
1112
<h1>Hi mera naam {{naam}} hai</h1>
13+
14+
<img src = "{{ url_for('static' , filename='logo.png') }}">
15+
1216
</body>
1317

1418

0 commit comments

Comments
 (0)