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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:26:10+00:00 2026-06-10T00:26:10+00:00

I’ve followed the instructions in this question , the documentation , and I’ve even

  • 0

I’ve followed the instructions in this question, the documentation, and I’ve even looked at this one, but so far I’m unable to get at my static files using python manage.py runserver.

These are my (relevant?) settings:

STATIC_ROOT '/home/wayne/programming/somesite/static'
STATICFILES_DIRS ('/home/wayne/programming/somesite/static/styles',
                  '/home/wayne/programming/somesite/static/admin')

In my urls.py:

from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# The rest of my urls here...
if settings.DEBUG:
    urlpatterns += staticfiles_urlpatterns()

I have the following code in my base.html

    <link rel="stylesheet" type="text/css" href="{% static "styles/main.css" %}">
    {% block styles %}
    {% for sheet in styles %}
    <link rel="stylesheet" type="text/css" href="{% static sheet %}">
    {% endfor %}

And I promise I’m not hallucinating:

(.env)wayne:~/programming/somesite/static$ pwd 
/home/wayne/programming/somesite/static 
(.env)wayne:~/programming/somesite/static$ ls 
admin  styles 

However, when navigate to http://localhost:8000/ my site is missing its stylesheets, and when I go to http://localhost:8000/static/styles/main.css I get 'styles/main.css' could not be found, and trying to navigate to localhost:8000/static/, or localhost:8000/static/styles it tells me that Directory indexes are not allowed.

What am I missing 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-06-10T00:26:12+00:00Added an answer on June 10, 2026 at 12:26 am

    Django’s handling of static files continue to be slightly confusing, particularly in terms of the naming of relevant settings.

    The short answer is to move your static files; instead of

    /home/wayne/programming/somesite/static
    

    put them in

    /home/wayne/programming/somesite/yourapp/static
    

    (where “yourapp” is obviously the name of your main application).

    The longer answer is that I think you’ve (understandably) become confused about the various settings. STATIC_ROOT only refers to the location where your static files should end up after running manage.py collectstatic. You don’t need this set (as you shouldn’t really need collectstatic) when developing locally. Either way, STATIC_ROOT should always refer to an empty directory.

    Your STATICFILES_DIRS setting would almost work, except that you’ve told Django there are two paths where it should find static files

    /home/wayne/programming/somesite/static/styles
    /home/wayne/programming/somesite/static/admin
    

    so when you do {% static "styles/main.css" %} it will look for

    /home/wayne/programming/somesite/static/styles/styles/main.css
    /home/wayne/programming/somesite/static/admin/styles/main.css
    

    and will obviously not find them. What might work is

    STATICFILES_DIRS = ('/home/wayne/programming/somesite/static',)
    

    but there’s no need to do that, as you can just rely on django.contrib.staticfiles.finders.AppDirectoriesFinder (in the default STATICFILES_FINDERS) and move your static files to an app directory.

    Hope this clears things up a little.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
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
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.