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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T13:25:05+00:00 2026-05-15T13:25:05+00:00

in my app, i want to use a css file, but the tempalte doesn’t

  • 0

in my app, i want to use a css file, but the tempalte doesn’t ‘know’ where the file is, though i’ve configured it as in tutorials:

in the urls.py (the urls file in the root of the site, not belonging to an app)

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.STATIC_DOC_ROOT}),

in the template

<link href="/site_media/default.css" rel="stylesheet" type="text/css" />

in the settings:

STATIC_DOC_ROOT = '/site_media'

where can i be wrong?
Thanks

  • 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-15T13:25:07+00:00Added an answer on May 15, 2026 at 1:25 pm

    Check django-annoying, it’s a very useful app with plenty of convenient decorators, middlewares and functions. If you add StaticServe middleware like that, Django will serve static if DEBUG = True without explicitly setting in urls.py.

    MIDDLEWARE_CLASSES = (
        'annoying.middlewares.StaticServe',
        'django.middleware.common.CommonMiddleware',
        'django.contrib.sessions.middleware.SessionMiddleware',              
        'django.middleware.doc.XViewMiddleware',               
        'django.contrib.auth.middleware.AuthenticationMiddleware',                    
    )
    

    Second, check your MEDIA_URL (in your case it’s STATIC_DOC_ROOT, but you should use MEDIA_URL) and MEDIA_ROOT path. MEDIA_ROOT should point to absolute path to your static directory. This is how I do it in setttings.py:

    import os
    
    
    def rel(*x):
        return os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
    
    # MEDIA_ROOT will point to media directory where settings.py is located
    MEDIA_ROOT = rel('media')
    MEDIA_URL = '/media/'
    

    You can use the same function to set path to your templates dir.

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

Sidebar

Related Questions

I want to use push notification in my app.i want to know that do
I want to use session object in my web app.I want to store some
In my Controller in a Asp.net MVC 1 app I want to use UpdateModel
I'm developing a Mac OS X Cocoa app and want to use several .dylib
i am using tab bar control in my app and want to use the
I created a console app that I want to use in a scheduled package
I have a UIWebView in my app which I want to use to display
I want to use modal pop-up windows in our web app in Ruby on
I want to use geoJSON-formatted Data in my iPhone app. THere is a JSON
I want to use many bars like this one in my app (i don't

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.