Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8078463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:48:09+00:00 2026-06-05T15:48:09+00:00

Questions exactly like this have been asked before, i’ve read them all and tried

  • 0

Questions exactly like this have been asked before, i’ve read them all and tried to make sense of the official django documentation on the subject but i’m still struggling to use static files on the virtual server. More specifically i’m just trying to get my template, Base.html, to use base.css.

My folder structure looks like this:

manage.py
static/CSS/base.css
VergeGreenITEvent_Website/settings.py
VergeGreenITEvent_Website/views.py ect
VergeGreenITEvent_Website/Webpage_Templates/Base.html

(no app folder at the moment, as I was following “The django book” to learn and hadn’t gotten to that bit!)

The complete settings.py can be viewed here: http://pastebin.com/JB3mKRcJ

In my Base.html template I now have the code:

<head>
    <title>Verge Green IT</title>
    {% load static %}

    <link rel="stylesheet" href="{% static "CSS/base.css" %}" type="text/css" />
</head>

CSS still isn’t being applied.enter image description here Could you help me figure out what i’m doing wrong? I’d be incredibly grateful.

I’m using the latest version of Django. (1.4)


urls.py :

from django.conf.urls import patterns, include, url
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
import views

urlpatterns = patterns('',

    url(r'^$', views.Home),

)

if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns() #this serves static files and media files.
    #in case media is not served correctly
    urlpatterns += patterns('',
        url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
            'document_root': settings.MEDIA_ROOT,
            }),
    )
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:48:11+00:00Added an answer on June 5, 2026 at 3:48 pm

    If you’re using Django 1.4 then I would use the static tag:

    {% load static %}
    
    <link rel="stylesheet" href="{% static "CSS/base.css" %}" type="text/css" />
    

    You probably need this in your urls too, in development files are served via django

    if settings.DEBUG:
        urlpatterns += staticfiles_urlpatterns() #this serves static files and media files.
        #in case media is not served correctly
        urlpatterns += patterns('',
            url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
                'document_root': settings.MEDIA_ROOT,
                }),
        )
    

    Also in your settings it’s common practice to avoid hardcoding locations, here’s an example (by the way do you have the static filefinders in your settings?

    PROJECT_ROOT = path.dirname(path.abspath(__file__)) #gets directory settings is in
    
    STATIC_ROOT = path.join(PROJECT_ROOT,'static-root')
    # this folder is used to collect static files in production. not used in development
    
    STATIC_URL =  "/static/"
    
    STATICFILES_DIRS = (
        ('', path.join(PROJECT_ROOT,'static')), #store site-specific media here.
    )
    
    # List of finder classes that know how to find static files in
    # various locations.
    STATICFILES_FINDERS = (
        'django.contrib.staticfiles.finders.FileSystemFinder',
        'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    )
    
    TEMPLATE_CONTEXT_PROCESSORS = (
        # other processors...
        "django.core.context_processors.static",
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize questions quite similar to this have been asked, though not exactly this
I realize that similar questions have been asked about this before here on SO,
Similar questions have been asked, but nothing exactly like mine, so here goes. We
Variations of this question have been asked before, but it seems like the issue
Various incarnations of this question have been asked here before, but I thought I'd
I know variants of this question have been asked frequently before (see here and
So, if this question has been asked before, I'm sorry. I'm not exactly sure
Sorry If something like this has already been asked, but I can't find exactly
I have referred to similar questions like this and have done exactly the same
Sorry I know similar question have been asked many times before but like most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.