'Problem linking CSS file to HTML file using Django
I had some issues linking a CSS file to HTML file while using Django. Here is my HTML file where I linked a static file name home.css
{% load static %}
<link rel="stylesheet" href="{% static 'home.css' %}" type="text/css">
My folder is organised as so for my templates folder:
\Users\me\Desktop\mysite\templates\base\home.html
And for my static folder:
\Users\me\Desktop\mysite\static\home.css
Doesn't someone know from where does the problem come?
Solution 1:[1]
Check if you set your static folder correct on the settings.
# Static files (CSS, JavaScript, Images)
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static'),
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Romeo |
