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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:07:29+00:00 2026-05-26T05:07:29+00:00

I am setting up a beginner django app and I cannot make it display

  • 0

I am setting up a beginner django app and I cannot make it display static content. (css and jpg) files. The documentation is confusing and I need some help at a very basic level.

My static files are located in: ‘/home/me/django_projects/myproject/site_media’. Under here there are directories: ‘images’ and ‘css’

I am getting 404 errors on everything static. Even if I try to pull the file directly from: http://localhost:8000/site_media/images/test_image.jpg

Here is the html code that I that is supposed to trigger static content:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Django Test </title>
<link href="{{ STATIC_URL }}/css/style.css" rel="stylesheet" type="text/css"   media="screen" />
</head>
<body>
   This is my body...   blah blah blah
   <p>Here is an image:  <img src="{{ MEDIA_URL }}images/media.jpg" alt="Foobar" />
</body>

Below are my settings files. I’ve tried about every combination of media and static configuration I can think of. Does anyone see what I am doing wrong here?

File: settings.py

# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = '/home/me/django_projects/myproject/site_media/'
MEDIA_URL = '/media/'
ADMIN_MEDIA_PREFIX = '/admin_media/'
STATIC_ROOT = ''
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    "/home/me/django_projects/myproject/static",  
)

# 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',
)

#...
INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.admin',
    'django.contrib.admindocs',
    'jim',
)

File: urls.py

urlpatterns = patterns('',
    (r'^customers/$', 'jim.views.index'),
    (r'^customers/(?P<customer_id>\d+)/$', 'jim.views.detail'),
    (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/media'}),
    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/media'}),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    url(r'^admin/', include(admin.site.urls)),
)   

Does anyone see whats wrong 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-26T05:07:30+00:00Added an answer on May 26, 2026 at 5:07 am

    Looks like you might have two forward slashes:

    STATIC_URL = '/static/'
    "{{ STATIC_URL }}/css/style.css"
    

    would give you

    "/static//css/style.css"
    

    view the page source in the browser and see how the url is being written

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

Sidebar

Related Questions

I'm a beginner in Django. I need to setup a website, where each user
I am a total beginner to programming and Django so I'd appreciate help that
As we know there are some config setting we can make to web.config file
I'm having some beginner problems setting an FFI struct in Ruby. What I want
I'm trying to create a simple Quiz app (I'm a beginner), when I launch
I am a beginner in SharePoint and I need to create publishing site that
Being a beginner of using Django, i am trying to add some module for
I'm a django beginner and am reading Practical django Projects. The book instructs to
I'm a beginner in programming. I wrote a script to set DNS setting using
I am a beginner with CakePHP trying to build my first app. I have

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.