I can't drag the css outside??? (django)

Asked 2 years ago, Updated 2 years ago, 44 views

In the garage Create a 1.html file and style.css file in the template I'm going to drag the css in html to the outside in style.css Why not?

<!DOCTYPE html> Hello world

/* style.css */

h1 { color: orange; }

Even if I say localhost:8000/style.csss, there's no change What's the difference?

django python

2022-09-21 19:22

1 Answers

Static files such as css and js are managed separately by static files

https://docs.djangoproject.com/en/1.9/howto/static-files/

I suggest you read this document There are cases where static folders are placed per app, and you can collect them and use them in one place

I recommend that you collect them in one place and use them.

How to put it together at settings.py

Write down the absolute path of the folder where static files are collected in the STATICFILES_DIRS list

You can load static from the template file

Kindly noted in the document above, but when you write down the path

os.path.join(BASE_DIR, "static") If you do it like this, Python will follow os.

\ I will attach // (separate folders by , (comma)


2022-09-21 19:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.