Connecting css. I have problem with directories

Hi, how to correctly connect css in my case P.S upload.html is the main file
fghjkl;'

Hello @pomoykastrimov, and thank you for posting on ask! Please provide a link to your repl so we can figure out how best to help you. Thanks!

https://replit.com/@pomoykastrimov/InstagramChecker

I don’t see a stylesheet or an “uploads.html” file in that repl at all, is that the right one?

i change the uploads.html to index.html

Okay, where is the stylesheet? (style.css)
Edit: nvm, found it you moved it to the root.

Flask doesn’t work the same as static HTML. To connect the files, you must use their URL. Also move your CSS to a folder called “static/css”.
To connect CSS, use this:

<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">

Wouldn’t you also need to add a route for that to main.py?

css now works thanks and photo now how to connect it?

Also keep that in static.

<img src="{{ url_for('static', filename='photos/image.png' }}"/>

thanks for help! <3333333

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.