Issues with CSS file loading in Django

My program has a CSS file that I defined, but for some reason it's not working. When I checked with firebug, the status is 200 OK, but no changes are occurring. I'm unsure if there is a syntax issue with my CSS file. Can you please provide your insights?

urls.py

from django.conf.urls.defaults import patterns, include, url
from preview,view import *
import os

site_media = os.path.join(os.path.dirname(__file__),'site_media')

urlpatterns = patterns('',
              (r'^catalog/$','home'),
              (r'^site_media/(?P<path>.*)$,'django.views.static.serve',{'document_root':site_media}),)

css.css

*{ 
    margin:0; 
    padding:0; 
} 
html{ 
   font-size:medium; 
} 
html,body{ 
    background-color:Silver; 
} 
.cb{ 
    clear:both; 
} 
.fr{ 
    float:right; 
} 
.fl{ 
float:left; 
} 
.bn{ 
    border:none; 
}#main{ 
     margin: 0 auto; 
     width:900px; 
     background-color:White; 
} 
.bannerIEPadder, .sidebarIEPadder, .contentIEPadder{ 
     padding:10px;  
} 
.navIEPadder, .footerIEPadder{ 
     padding:5px; 
} 
#banner{ 
     width:900px; 
     height:75px; 
     background-color:DarkOrange; 
     color:White; 
     font-size:36px; 
     font-weight:bold; 
position:relative; 
} 
div.cart_box{ 
     position:absolute; 
     top:10px; 
     right:10px; 
     font-size:medium; 
} 
div.cart_box a{ 
     color:white; 
} 
#sidebar{ 
     width:200px; 
     float:left;; 
} 
#content{ 
     width:700px; 
     float:left; 
} 
#footer{ 
     clear:both; 
     background-color:#98AC5E; 
     color:White; 
     text-align:center; 
} 
a.skip_link{ 
     position:absolute; 
     left:-1000px; 
     top:-1000px; 
} 

base.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "XHTML1-s.dtd" ><html 
xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> 
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
     <title>{% block title %}{% if page_title %}{{ page_title }} - {% endif %}      
          {{ site_name }}{% endblock %}</title> 
     <meta name="keywords" content="{{ meta_keywords }}" /> 
     <meta name="description" content="{{ meta_description }}" /> 
     <link rel="stylesheet" href="/site_media/css.css"
           type="/text/css"/>

</head> 
<body> 
     {% block site_wrapper %}{% endblock %} 
</body></html>

catalog.html

{% extends "base.html" %} 

{% block site_wrapper %} 
<div id="main"> 
     <a href="#content" class="skip_link">Skip to main content</a> 
     <div id="banner"> 
          <div class="bannerIEPadder"> 
               <div class="cart_box"> 
                [link to cart here] 
                </div>
 Modern Musician 
          </div> 
     </div> 
     <div id="navigation"> 
          <div class="navIEPadder"> 
                [navigation here] 
          </div> 
          </div> 
         <div id="middle"> 
              <div id="sidebar"> 
                   <div class="sidebarIEPadder"> 
                    [search box here] 
                   <br /> 
                    [category listing here] 
                   </div> 
              </div> 
              <div id="content"> 
                   <a name=”content”></a> 
                   <div class="contentIEPadder"> 
                        {% block content %}{% endblock %} 
                   </div> 
              </div> 
        </div> 
             </div> 
             <div id="footer"> 
                  <div class="footerIEPadder"> 
                       [footer here] 
                   </div> 
             </div> 
        </div> 
        {% endblock %}

index.html

{% extends "catalog.html" %} 

{% block content %} 
     <h2>Welcome!</h2> 
{% endblock %}

Answer №1

Make sure to update the link type in your base.html file from "/text/css" to just "text/css".

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

The loading icon appears stuck and does not rotate on iOS version 15.3 and above, but functions properly on versions below 15.3

The loading icon does not spin on iOS versions > 15.3 or 16.1, but it works perfectly fine on lower iOS versions for iPhone and iPad, as well as on Android browsers. Below is the CSS code for reference. I've attempted using webkit for Safari and a ...

What is the method for showcasing an h1 heading and an unordered list link side by

Can you help me align my h1 and ul elements on the same line in my header? I want to have my logo and navigation links next to each other (This extra text is just filler) Below is the code snippet: HTML: <div id="header"> <h1>Logo</h1> ...

There seems to be an issue with the visibility of the b-button within the b-table component in

I'm new to Vue Js and I'm having trouble with my b-button not displaying in my table. I can't figure out why. Below is my HTML code: <div id="listlocales"> <div class="overflow-auto"> ...

What are some ways to optimize the use of the jquery.mCustomScrollbar.js script?

I have a myriad of inquiries and would greatly appreciate your assistance in addressing them. Despite spending countless hours attempting to solve the issue independently, I have been unsuccessful. One question that plagues me is why, when using Google Ch ...

Align content to the bottom using Bootstrap 4

Looking for help with aligning content to the middle and bottom on a full-page bootstrap layout? The first page has a background image in the first div, and a darker layer on top in the second div. <div class="h-100 w-100"> <div class="h-100 w-10 ...

Floating boxes with a stationary top alignment

My HTML "toolbar" has multiple widgets displayed in a horizontal layout. Each widget is represented by a div element in the source code: <div id="widget1" /> <div id="widget2" /> <div id="widget3" /> To position these divs, I use float: ...

Introducing a novel class designed to leverage the attributes of another class

Is there a way to use the @extend feature in CSS to inherit properties from one class to another? Imagine having two CSS files loading on a page in this order: <link rel="stylesheet" href="/css/one.css" media="screen"> <link rel="stylesheet" href ...

Issues with loading response data arise with certain image uploads in Django, despite receiving a status code of 200

I'm currently sending an ajax post request to a Python Django view that consistently returns a successful JSON response. The code snippet below shows the Django view function: # views.py @csrf_exempt def success_response(request): """ Returns ...

placing a div inside another div

As I work on my website, I have created several panels with a repeating texture. To enhance the visual appeal of the site, I decided to add colored divs and adjust opacity for a tint effect instead of using separate images. The issue I'm facing is th ...

Erase blob_over from the Wordpress menu hover effect

I've created a unique style for the Donate button on this website, but I'm struggling to remove the hover effect. Any suggestions on where to start? Website URL: This is my Custom Class CSS: .donate { background:#4A1383; padding:0px 10px 0px 1 ...

Issues with fetching objects using get_object_or_404 in Django

Having trouble with a certain part of my code that’s throwing an error mentioning 'element_id' is not a valid keyword argument. I thought it was because I wasn’t calling the right model initially, but even after correcting that, the issue per ...

Utilize open-source tools for website design

Can anyone suggest an open source toolset for WYSIWYG HTML/CSS design? What tools have you found most helpful in your projects? ...

Can an <option> element in WebKit be customized by adding an icon to it?

I have integrated a WebView into one of my software applications, and within the HTML page it is rendering, there is a <select> tag. I am interested in enhancing the <option> elements within this select tag by adding icons to them: (The shadow ...

Alignment issue detected

I was attempting to center these 4 divs inside a container both horizontally and vertically, but they are stuck at the top edge of the <div>. They aren't moving down and remain fixed at the top. /* Footer */ #footer { width: 100%; hei ...

Implementing pagination with Django-REST and AngularJS

I successfully integrated my angularjs app with django-rest, but encountered a problem when implementing pagination. Below is the code for my restservice and controller: // restservices.js // API call for all images in an event services.factory('Imag ...

Change the class of each item in a list individually by hovering over them with the mouse using JavaScript

How to toggle classes in a list item one by one using the mouseover event in JavaScript? const items = document.querySelectorAll("ul li"); let currentItem; for (const item of items) { item.addEventListener("mouseover", e => { currentItem &am ...

Steps to add a background image without a border:

I am struggling to insert an image within an anchor tag. <a> <img calss="imageclass"/></a> Whenever I try, a border appears around the image. I have attempted using CSS properties like border: 0 and border-style:none, but nothing seems ...

Add CSS properties to child elements that are not of a specific selector, while styling their descendants without any restrictions

Seeking assistance for an Angular application, but the query also pertains to CSS principles in general. In my Angular project, I have a main component containing several child components, all with standard view encapsulation. Specifically, I am looking t ...

Struggling to effectively mock classes with Python's 'mock' library in a Django environment

In my Django project, I am currently using Python's "mock" module to simulate classes and functions. Here is the breakdown of the project structure: Project name --> 'hello' App1 ----> hello App2 ----> ...

The Bootstrap column class is malfunctioning

Recently, I've been diving into the world of web development. I attempted to create three divs in one row using Bootstrap col class, but unfortunately it didn't turn out as expected. Two divs ended up in a row with some blank space, while the thi ...