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

  • Home
  • SEARCH
  • 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 7587187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:36:38+00:00 2026-05-30T19:36:38+00:00

I came from PHP, Python and Django are new to me. I have a

  • 0

I came from PHP, Python and Django are new to me. I have a simple problem but have already stuck with this for hours and still couldn’t find out what went wrong.

I want to insert a simple image into the template.

I have followed
TemplateSyntaxError 'staticfiles' is not a valid tag library' and https://docs.djangoproject.com/en/1.3/howto/static-files/#with-a-template-tag

Following are my settings.

  1. my static folder is located in /myproject/myapp/static/. And the img path is /static/images/hi.jpg.
  2. the src value in img tag is "/static/images/hi.jpg" when the page is rendered
  3. Setting in setting.py

    STATIC_URL = '/static/'    
    INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
    django.contrib.messages',
    'django.contrib.staticfiles',
    'myapp',
    'django.contrib.admin')

  1. In template, I have

    
     {% load static %}
     {% get_static_prefix as STATIC_PREFIX %}
    
    

    and the source part of the image

    src="{{ STATIC_PREFIX }}images/hi.jpg"

  1. finally, the url of the app is http://127.0.0.1:8000/myapp/

what part is wrongly configured? Any idea? Thank you so much for the help. Sorry for the poor formatting.

  • 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-30T19:36:39+00:00Added an answer on May 30, 2026 at 7:36 pm

    In your urls.py you should add the static files urls:

    # urls.py
    
    from django.contrib.staticfiles.urls import staticfiles_urlpatterns
    
    urlpatterns = patterns('',
        ...
    )
    
    urlpatterns += staticfiles_urlpatterns()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came from PHP language(codeigniter), but now I learning ASP.Net MVC :) In PHP
There's this already populated database which came from another dev. I'm not sure what
let me tell you a bit about where this question came from. I have
Update : success progress but still a problem : new data reloaded after refreshing
I have merge two array with php function merge_recursive (both came from sql query)
I have a simple PHP form that sends an email to its visitors from
I'm relatively new to ruby and i came from php. One thing that it
fairly new to Objective-C and iOS development (coming from PHP) and I have a
Let's suppose I have a string that contains 7.2769482308e+01 (this number came from 3rd
I have a string in PHP (came from some data source), which represents a

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.