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 6885257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:36:44+00:00 2026-05-27T05:36:44+00:00

I have a template, base.html , which is used in several other templates for

  • 0

I have a template, base.html, which is used in several other templates for various views. Each of those templates starts with the appropriate {% extends "base.html" %}. In the base template, I want to specify a static stylesheet thusly:

<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}/base.css"/>

However, when it renders most of my templates, the value of STATIC_URL is empty, so the attribute is merely href="/base.css", which doesn’t load. The variable is properly defined for the template that I have tied to the default login view, django.contrib.auth.views.login, but for my own custom views, it’s undefined.

I am just trying to get this working in the development environment with runserver, so the CSS file is in the static subdirectory of the app.

Here are the relevant bits from my settings.py, which are all the defaults:

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

# Additional locations of static files
STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

# 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',
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages',
)

In my urls.py I also have added:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns

#...

urlpatterns += staticfiles_urlpatterns()

Any ideas what I’m doing wrong? As far as I can tell this is what you’re supposed to do for serving app-specific static files in development, based on the 1.3 documentation.

  • 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-05-27T05:36:44+00:00Added an answer on May 27, 2026 at 5:36 am

    Perhaps this can help:

    If {{ STATIC_URL }} isn’t working in your template, you’re probably
    not using RequestContext when rendering the template.As a brief
    refresher, context processors add variables into the contexts of every
    template. However, context processors require that you use
    RequestContext when rendering templates. This happens automatically if
    you’re using a generic view, but in views written by hand you’ll need
    to explicitly use RequestContext To see how that works, and to read
    more details, check out Subclassing Context: RequestContext.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have template base.html and some children templates. I don't know how to set
I have a base template in Django and several html files that are children
I have the following structure /templates/base.html templates/index.html --- here i have inherited base.html which
I have a base.html template that contains a list of links. Example: <div id=sidebar1>
I have a django template which extends the base template that has code to
I have a Django website as follows: site has several views each view has
I'm using django 1.3 I'm using a base.html template which my pages inherit from.
Is it possible to use the using declaration with template base classes? I have
I want to create templates for base new reports on to have common designs.
I have a template class that I serialize (call it C), for which I

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.