How to Use CSS Javascript and Images With Flask Static Files - Flask Fridays #7

in #flask2 months ago

In this video I'll show you the correct way to use CSS, Javascript, and Images in your Flask app using the Static directory and url_for() tag.

To use CSS, Javascript, and Images in your flask app, you need to create a static directory. Inside that directory, create directories for css, js, and images. Then inside each of those directories, place your css, javascript, and image files.

Then, to access any of those things, use the url_for tag like this:
{{ url_for('static', filename='images/image.png' }} the src for whatever file you're tying to call.

✅ Watch The Flask Playlist

▶️ Get The Code

✅ Subscribe To My YouTube Channel:

▶️ See More At:

✅ Join My Facebook Group:

▶️ Learn to Code at
Take $22 off with coupon code: youtube

✅ Buy a Codemy T-Shirt!

Coin Marketplace

STEEM 1.20
TRX 0.13
JST 0.141
BTC 60752.79
ETH 2160.86
BNB 543.96
SBD 8.84