I added a CSS file to my Django project in the 'static' directory and referenced it in my index.html file in the 'templates' directory following the Django documentation, but unfortunately, the CSS is not taking effect!
Here are the file paths:
index.html: myproject/myapp/templates/html/index.html
index.css: myproject/myapp/static/css/index.css
This is the relevant HTML code:
{% load static %}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head lang="eng">
<link rel="stylesheet" type="text/css" href={% static "css/index.css" %}/>
</head>
<body onload="myFunction()">
----some code----
</body>
</html>
The content of my settings.py file is as follows:
(contents of settings.py)
The URLs are defined in urls.py as shown below:
(contents of urls.py)
The URL configuration within the 'myapp' directory is specified in url.py:
(contents of url.py in myapp)
Finally, here is the view function implemented in views.py:
(contents of views.py)
Despite all these configurations, I'm still encountering a 404 error for my CSS. Can someone please assist me in resolving this issue so that my project runs smoothly?