Struggling to personalize the background color on the app template; experimented with repositioning the app name above the Django admin app in the INSTALLED APPS section,

Important changes needed in settings.py file

INSTALLED_APPS = [
'store.apps.StoreConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]


 STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')
]

Instructions for main.html file

<!DOCTYPE html>
<html lang="en">
{% load static %}
<head>
<title>Ecom</title>
<meta charset="UTF-8">

<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="aac8c5c5ded9ded8cbdaea9f849a9ac2dc8b99">[email protected]</a>/dist/css/bootstrap.min.css" 
rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" 
crossorigin="anonymous">

<link rel="stylesheet" href="{% static 'css/main.css' %}">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>
<body>
<h2>main</h2>
(% block content %}
 
{% endblock %}
</body>

CSS rules in main.css file

body {
background: #FF0000; }

An alternative using !important (not recommended)

The template I was attempting to display, store.html

{% extends 'store/main.html' %}
{% load static %}

{% block content %}
 <h1>color</h1>
{% endblock %}

Page preview available here

View image description here

Project file structure,

src
   -static
     -css
       -main.css
   -store
     -templates
        -store
          -main.html
          -store.html

The issue lies in not being able to see the customized background color of the body. Is the problem related to bootstrap, my custom css properties, {% extend ...}, or a missing element in settings.py. As a Django novice, any guidance on resolving this bug would be greatly appreciated.

Answer №1

With the assistance of Ivan Starostin, I was able to resolve my issue by following a thread [https://stackoverflow.com/questions/15562384/how-to-force-chrome-browser-to-reload-css-file-while-debugging-in-visual-studio]. It turns out, the problem wasn't related to Django or CSS, but rather due to caches. Fortunately, hitting CTRL + F5 or SHIFT + CTRL + R performed a hard refresh and fixed the issue for me.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Alignment on the top and floated to the right

I am absolutely baffled by this. What is preventing my third div (content-col-text) from floating right? It refuses to move up and align with large-image-container - which is within the outer div wrapper (entry-content).. I have double-checked for any ...

Updates made to CSS are not appearing on the Joomla site

My website is based on Joomla and has been functioning well since it was created. However, recently I have noticed that any CSS changes made in the files are not showing up on the site. I have tried clearing the cache and viewing it from different ISPs, ...

Navigate through previous and next siblings in jQuery until a difference is found

Here's the issue: I have a div with multiple siblings positioned before and after it. For example: <div id="parent"> <div class="invalid"></div><!-- break iteration here !--> <div class="operand"></div> <div cl ...

The height of the image is equal to the height of the phone/tablet - functioning correctly only in Chrome

, I'm currently fine-tuning my portfolio website with the help of responsive and adaptive design using mobile_detect.php. The challenge lies in getting the codes to align perfectly for desktop and handheld devices. To simplify testing on desktop befo ...

Expand the accordion to reveal all the content

I'm facing an issue with my accordion where a scrollbar appears in every content section. To fix this, I tried setting overflow: hidden in the CSS: .ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: hidd ...

Having trouble logging in with a custom User model in Django REST Framework that extends AbstractBaseUser

Utilizing Django REST Framework, I have developed a unique user model that authenticates users via their phone numbers instead of usernames. Though I can successfully create a superuser with the create_superuser method and see the superuser in the database ...

How to prevent editing of a specific model instance in Django admin panel

How can I prevent editing in Django admin for certain model instances based on their status? I want to disable editing if the status is greater than 1. I already know how to remove the link on the left side, but setting a correct URL could still allow for ...

Using the radius to determine the center point of the circle

<span class="qs">Q{{i + 1}} <a href="#question-view"></a></span> <div class="tooltipp text-center bubble[ngStyle]="bubbleStyle(prof?.proficiencyBrightness, prof?.proficiencyRadius)"> </div> In the illustration below, ...

Button click not triggering JQuery datepicker functionality

Currently, I am facing an issue with the jQuery datepicker functionality. It seems to work fine when clicking on a button in Mozilla Firefox, but unfortunately, it does not function properly in Google Chrome or Internet Explorer. Can someone please provide ...

Checking the validity of an input element with jQuery: How to determine if the valid or invalid pseudo-class has been applied?

Is there a way to check for the application of the CSS3 :valid or :invalid pseudo-class on an input element using jQuery? I want to verify if the form element has passed CSS validation before allowing the submit button to be enabled. Here are some methods ...

Is there a way to create a table that has varying columns for each row?

I am currently working with bootstrap4 and I am trying to create a table that has 3 columns in the first row and 4 columns in the following two rows. I want it to look like this: https://i.sstatic.net/nuI55.png Here is my existing table: <link href ...

Troubleshooting non-responsive Bootstrap navigation bars in HTML/CSS

As I implement a Bootstrap Navigation Bar at the top of my webpage, I notice that it tends to collapse when the page hits a certain length. This seems to be a common feature among many Bootstrap Navbars, where all headings are condensed into a button on th ...

What is the best way to ensure that all background images are displayed in IE when printing?

I am currently working on formatting a page for printing in Internet Explorer. I have encountered an issue where when I select the "Print background and images" option in Page Setup and preview the page, only certain icons are displaying. However, all icon ...

Tips for aligning the text horizontally in an input field with a neighboring element

Hello amazing community, I'm searching for a neat way to align the text of an element horizontally with that of an Angular Material input field. Here is the code I am using: <div style="display: flex"> <div>Greeting: </div> ...

Dynamic Fill Colors in SVG File Through Vue Components

I am currently developing a unique social media platform using VueJS 3. For the design aspect, I incorporated Twitter's iconic logo saved as an .svg file, easily displayed using the <img /> tag. To modify its color, I utilized the fill="#f ...

Utilize Pseudo Elements for Designing a Unique Background Overlay

I am aiming to create a div with a customizable background, and then utilize a pseudo element to generate a semi-transparent white overlay that will lighten the background of the div. The crucial requirement is for the "overlay" to appear beneath the conte ...

How can I adjust the size and alignment of each line within a single cell in an HTML table?

<!DOCTYPE html> <html> <head> <title></title> <meta charset="UTF-8"> <style> .chess-board { border-spacing: 0; border-collapse: collapse; } .chess-board ...

Issue with consistency in the height of product card titles across rows

Looking for suggestions on achieving consistent card title height per row to ensure image alignment at the bottom. The solution should be responsive. Any CSS tips or jQuery plugins are welcome! I've searched online but haven't found a similar sol ...

Explore Django models through multiple layers of foreign key relationships

In the process of developing a dictionary application using Django, I have defined three main models: Expression, Definition, and City. The relationship between them is such that each Expression can have one or more Definitions, and each Definition is lin ...

Attempting to alter CSS styles programmatically using JavaScript is proving to be ineffective

After trying numerous methods, I have come to the conclusion that the current approach works for others but not for me. Can anyone suggest an alternative way to write this code? Current CSS .aw-widget-current-inner div.aw-widget-content a.aw-current-weat ...