Skip to content Skip to sidebar Skip to footer

Unable To Apply Css On My Html File Django

I have seen alot of solutions here regarding this issue but unable to resolve my problem, I am trying to apply my style.css present on this path \...\static\css I have following di

Solution 1:

You don't need to do css/style.css

<htmllang="en"><head>
        {% load static %}
        <metacharset="UTF-8" /><metahttp-equiv="X-UA-Compatible"content="IE=edge" /><metaname="viewport"content="width=device-width, initial-scale=1.0" /><linkhref="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css"rel="stylesheet" /><linkrel="stylesheet"href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" /><linkrel="stylesheet"href="{% static 'style.css' %}" /><linkrel="style**strong text**sheet"href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css"><title>{% block title %}My Website Name{% endblock %}</title></head>

Solution 2:

I am able to resolve the issue by updating the following line in settings.py

STATIC_DIR = os.path.join(BASE_DIR, 'Aqi_dash/static')

and I have also update the following code in html file:

link rel="stylesheet" href="{% static 'style.css' %}"

and i am able to successfully apply the css on my index.html

Post a Comment for "Unable To Apply Css On My Html File Django"