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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:28:20+00:00 2026-05-31T22:28:20+00:00

I’ve been trying to follow every single tutorial and thread there is, i jast

  • 0

I’ve been trying to follow every single tutorial and thread there is, i jast cant get it togheter.

Sorry, but please exlpain it to me as if i was three years old..

What i have:
a CSS that i’d like use, styling a template.

How to get there:
MD: project/app/static/

place style.css there

settings.py:

STATIC_ROOT = '/project/app/static/'

STATIC_URL = '/static/'

(Should’nt this at least give me the string ‘/static/’, when i try printing {{ STATIC_URL }} in the template..?)

template:
<LINK REL=StyleSheet HREF="{{ STATIC_URL }}/style.css" TYPE="text/css" MEDIA=screen>

Seems to me, the next logical thing would be to create an /static/-url aswell?

I’m really lost here..

  • 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-31T22:28:21+00:00Added an answer on May 31, 2026 at 10:28 pm

    Django’s staticfiles system is about two things:

    1. Combining static files from a number of (app-specific) directories into a single place from which they can be served

    2. Serving those files over HTTP

    You want #1 if you have a number of static files located in different directories. You want #2 if you want to see those files while you are using the development server. In production, you usually skip #2, because the purpose of #1 is to put the files somewhere that your web server can access them.

    Organizing and collecting static files

    With that said, here’s how you get #1:

    settings.py:
    
    # This is a filesystem path
    STATIC_ROOT = '/path/to/my/project/collected-static-files/'
    
    # This is a URL prefix
    STATIC_URL = '/static/'
    
    INSTALLED_APPS = (
        ...
        'django.contrib.staticfiles',
        ...
    )
    TEMPLATE_CONTEXT_PROCESSORS = (
        ...
        'django.core.context_processors.static',
        ...
    )
    

    At this point, you can do a few things:

    1. You put your static files in an ‘/static/’ directory under each of your apps. That’s where django will look for them. There is an additional setting, STATIC_DIRS, that you can use if you have static files that are outside of your apps.

    2. You can run manage.py collectstatic to have Django go through all of your apps, finding all of the static files, and copying them into /path/to/my/project/collected-static-files (That’s why that setting is a filesystem path.)

    3. You can use {{ STATIC_URL }} in templates to access the files.

    Serving static files over HTTP

    In development mode, under the dev server, Django will automatically serve files out of the STATIC_ROOT directory.

    Basically, Django will add a URL handler for URLs of the form

    /static/some-dir/some-file-name
    

    And serve content from your hard drive, from the filesystem path

    /path/to/my/project/collected-static-files/some-dir/some-file-name
    

    In production, this won’t happen automatically, so you will have to configure your web server to do the same thing. (It’s just not a good idea to run all of your static files through Django’s full processing pipeline. The web server can do it much more efficiently)

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

Sidebar

Related Questions

I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into

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.