Reputation: 21
I'm new in Django.
I have no errors in code but CSS
affect don't show in browser this my codes and my project folders
this is base.html
<!DOCTYPE html>
{% load static %}
<html lang ="en">
<head>
<title>Investissement | 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 home.html
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row">
<div class="col">
<div id="home-content">
<h1>Investissement @2019</h1>
<h3>Your voice Matter!</h3>
</div>
</div>
</div>
</div>
{% endblock %}
this is styles.css
h1 {
color :red;
}
body{
background-image: url('../img/p.jpg');
}
#home-content {
text-align:left;
padding-top:20%;
}
in settings file i do this :
# 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/investissement/static/"
STATICFILES_DIRS =[os.path.join(BASE_DIR, "static"),]
note: the static folder and templates are in same repertory with manage.py
the result no css affect are show and no code error
Upvotes: 0
Views: 135
Reputation: 36
Often times browsers will cache files like css to improve loading speed. You can disable that in browser in order to get the latest version of file (especialy important for development). If you are in Chrome you can do that by opening developer tools (CTRL+SHIFT+I or F12) and on the Network tab
there is a Disable cache
button.
Upvotes: 2