As a beginner in Django, I'm facing an issue where my CSS styles are not appearing in the browser even though there are no errors in my code. Below are excerpts from my project files:
This is the base.html file:
<!DOCTYPE html>
{% load static %}
<html lang ="en">
<head>
<title>Investment | Home</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap
/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/
iJTQUOhcWr7x9JvoRxT2MZw1T"
crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="{% static
'css/styles.css' %}">
</head>
<body>.....
This is the home.html file:
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col">
<div id="home-content">
<h1>Investment @2019</h1>
<h3>Your Voice Matters!</h3>
</div>
</div>
</div>
</div>
{% endblock %}
This is the styles.css file:
h1 {
color :red;
}
body{
background-image: url('../img/p.jpg');
}
#home-content {
text-align:left;
padding-top:20%;
}
In the settings file, I have defined the following for static files:
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL =' /static/'
STATIC_ROOT = "/home/p-amc-dgps-er/Bureau/investment/static/"
STATICFILES_DIRS =[os.path.join(BASE_DIR, "static"),]
It's important to note that the static folder and templates are in the same directory as manage.py.
Despite having no errors in the code, the CSS styles are not being applied in the browser. Any insights on what might be causing this issue would be greatly appreciated!