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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:49:47+00:00 2026-06-10T08:49:47+00:00

Possible Duplicate: Trying to serve django static files on development server – not found

  • 0

Possible Duplicate:
Trying to serve django static files on development server – not found

I just entered the world of Python and django, i am unable to set my URL using the STATIC_URL , i am currently developing locally with django 1.4. I read the django static file doc and seem to have added all what’s required, but still get a 404 error. I have read other Q&A on SO related to this, and tried all sorts of things, but could not make it work.

The error i get from the console

http://localhost:8000/blog/static/js/src/models/myfile.js 404 (NOT FOUND) 

My index.html page, which is my main page that the other pages extend has the following script :

<script src="{{ STATIC_URL }}/js/src/models/myfile.js"></script>

After going through other questions and answers on SO i tried editing my view by adding since my archive.html is rendering data :

from django.template import RequestContext
...
return render_to_response('archive.html', {'categories' : resultSet, 'data': queryData}, context_instance=RequestContext(request))

My directory structure –

mysite
|-- manage.py
|-- mysite
    |-- __init__.py
    |-- settings.py
    |-- urls.py
    |-- wsgi.py
 |-- blog
    |-- __init__.py
    |-- models.py
    |-- tests.py
    |-- views.py
    |-- temapltes
        |-- archive.html
        |-- base.html
    |-- static
        |-- js
        |-- myfile.js

My Settings.py

MEDIA_ROOT = ''
MEDIA_URL = ''
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    'C:/Python27/Scripts/mysite/blog/static',
# A Bit confused on the path here
)
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
)
TEMPLATE_CONTEXT_PROCESSORS = (
    "django.core.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    'django.core.context_processors.static',
)
TEMPLATE_DIRS = ( )

INSTALLED_APPS = (
    #..
    'django.contrib.staticfiles',
    'blog',
)

I think i have everything thats needed, but still no luck with it.

Where have i gone wrong, i am a bit confused on setting the “STATICFILES_DIRS” path, how i can get this working on my local machine

  • 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-10T08:49:48+00:00Added an answer on June 10, 2026 at 8:49 am

    You should change your directory structure:

    app level:

    /blog/static/blog/js
    

    project level:

    /static/js
    

    Also in Django 1.4 you can use the static tag for convenience:

    {% load static %}
    <img src="{% static 'js/abacadabra.js' %}" />
    

    Last but not least, you probably want to avoid hard coded paths, so change:

    STATICFILES_DIRS = (
        'C:/Python27/Scripts/mysite/blog/static',
    )
    

    to:

    PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
    
    STATICFILES_DIRS = (
        os.path.join(PROJECT_ROOT, 'static'),
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: javax.net.ssl.SSLException: Not trusted server certificate I am trying to connect to server
Possible Duplicate: Library not loaded: libmysqlclient.16.dylib error when trying to run 'rails server' on
Possible Duplicate: Cross-thread operation not valid I am trying to close the base of
Possible Duplicate: Change Notification with Sql Server 2008 Am just wondering is there's anyway
Possible Duplicate: trace() not written to flashlog.txt I am trying to log flash trace
Possible Duplicate: C# Update Table using SqlCommand.Parameters I'm trying to update an SQL Server
Possible Duplicate: How to find foreign key dependencies in SQL Server? i am trying
Possible Duplicate: upload files via iPad Hey guy's I'm trying to create a native
Possible Duplicate: cURL: Just trying to download a page I'm trying to submit this
Possible Duplicate: Implementation of a web-server I am trying to make an http server

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.