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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:00:43+00:00 2026-06-10T10:00:43+00:00

I am trying to build my first Django project from scratch and am having

  • 0

I am trying to build my first Django project from scratch and am having difficulty setting the background image. I am new to programming in general so forgive me if this is a stupid question.

I have read the documentation here on static file implementations and various stack overflow posts (here here and here) on setting the background image, but I still can’t get it to work.

I have:

  • installed the django.contrib.staticfiles as an installed app.

  • added this to the settings file:

    TEMPLATE_CONTEXT_PROCESSORS = (
    "django.contrib.auth.context_processors.auth",
    "django.core.context_processors.debug",
    "django.core.context_processors.i18n",
    "django.core.context_processors.media",
    "django.core.context_processors.static",
    "django.core.context_processors.tz",
    "django.contrib.messages.context_processors.messages",
    )

  • set the Static_Root and Static_URL files to STATIC_ROOT = ‘/Users/user_name/development/projects/ecollar_site/static/’ and ‘/static/’ respectively

  • put this code at the end of my URLs file:

    `if settings.DEBUG:
    urlpatterns += patterns('',
    (r'^/static/(?P<path>.*)$', 'django.views.static.serve',
    {'/ecollar_site/': settings.STATIC_ROOT,
    'show_indexes' : True}),
    )`
    
  • ran python manage.py collectstatic

  • and then put this line in the CSS file.

    body{ font:16px/26px Helvetica, Helvetica Neue, Arial; background-image: url("{{ STATIC_URL }}img/IMG_0002.jpg"); }

I know the static files bit is working because the CSS is loaded. And I can change the background color by using background-color: blue. But the static image is simply not being put as the background image. Have I made a rookie mistake somewhere?

  • 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-10T10:00:44+00:00Added an answer on June 10, 2026 at 10:00 am

    Your css file is not rendered by Django template engine and so {{ STATIC_URL }} is not being replaced. You’ll have to use /static/img/IMG_0002.jpg in the CSS file or move that bit of CSS in your html file’s style tag.

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

Sidebar

Related Questions

I'm very new to Django and am trying to build my first good app.
I'm new to TFS and trying to do my first automatic build through the
As a project to figure out Django I'm trying to build a small game.
I'm trying to build my first Django-powered blog, but I'm stuck in a point.
I'm trying to build my first project with the andengine. things work fine so
I'm new to NHibernate and am trying to build my first simple website. I
I am a fairly new to ROR. I'm trying to build my first web
I am trying to Build a simple search that first grabbs 'query' from a
I'm trying to build my first GAE app with jinja2. After overcoming a dozen
I'm trying to build my first GAE app with jinja2. After overcoming a dozen

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.