please solve my problem

Divya Thakur yogeswar.prasad1 at
Sun Jan 13 21:35:01 CET 2013

hello i need help for my ecommerce project ,and here i am facing some problem here is my 

"i want to show image by the help of MEDIA_URL and this is my template file code for this
<img src="{{ MEDIA_URL }}images/products/thumbnails/{{ p.image }}"  but it is not working 

and showing following error"

    raise TemplateDoesNotExist(name)
TemplateDoesNotExist: 500.html
[14/Jan/2013 01:08:11] "GET /static/images/products/thumbnails/12345 HTTP/1.1" 500 59

but when i am going to use this link <img src="{{ MEDIA_URL }}

images/products/thumbnails/rakesh.jpg >" although it is showing image but not showing 

anything else ahed of 
that link ,so i am unable to undersatnd that why this is happening although i know that 

all other things are right ,but it showing error in the template file

here is my file

# Django settings for ecomstore project.
import os
#import sys
#hack to accommodate windows
CURRENT_PATH = os.path.abspath(os.path.dirname(__file__).decode('utf-8')).replace('\


DEBUG = False

     ('rakeshsingh', 'rakeshsinghb58 at'),


    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 

'sqlite3' or 'oracle'.
        'NAME': 'ecomstore',                      # Or path to database file if using 

        'USER': 'rakeshsingh',                      # Not used with sqlite3.
        'PASSWORD': 'password',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used 

with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with 


# Local time zone for this installation. Choices can be found here:
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'America/Chicago'

# Language code for this installation. All choices can be found here:


# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# If you set this to False, Django will not format dates, numbers and
# calendars according to the current locale.
USE_L10N = True

# If you set this to False, Django will not use timezone-aware datetimes.
USE_TZ = True

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/"
#MEDIA_ROOT = "C:/Users/rakesh/Desktop/ecomstore/static/"

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "", ""
MEDIA_URL = '/static/'
#MEDIA_URL = "http://localhost:8000/static/"

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/"

# URL prefix for static files.
# Example: ""
STATIC_URL = '/static/'

# Additional locations of static files
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.

# List of finder classes that know how to find static files in
# various locations.
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',

# Make this unique, and don't share it with anybody.
SECRET_KEY = '2h(8t+9z4z-m(fuhl17eqp78q!yxo4&i54jofml3uoyv at a3y3x'

# List of callables that know how to import templates from various sources.
#     'django.template.loaders.eggs.Loader',

    # Uncomment the next line for simple clickjacking protection:
    # 'django.middleware.clickjacking.XFrameOptionsMiddleware',

ROOT_URLCONF = 'ecomstore.urls'

# Python dotted path to the WSGI application used by Django's runserver.
WSGI_APPLICATION = 'ecomstore.wsgi.application'

    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.

    # Uncomment the next line to enable the admin:
    # Uncomment the next line to enable admin documentation:

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See for
# more details on how to customize your logging configuration.
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
            'propagate': True,
SITE_NAME = 'Modern Shoppers'
META_KEYWORDS = 'Electronics,footwera,clothing,book'
META_DESCRIPTION = 'Modern Shoppers is an online supplier of electronics,footwear, and 

other accessories for people who want a different things'


here is my catalog.html file

{% extends "base.html" %}
{% block site_wrapper %}
<div id="main">
	<a href="#content" class="skip_link">skip to main content</a>
	<div id="banner">
		<div class="bannerIEPadder">
			<div class="cart_box">
			[link to cart here]
			Modern Shoppers
	<div id="navigation">
		<div class="navIEPadder">
			{% include "tags/navigation.html" %}
	<div id="middle">
		<div id="sidebar">
			<div class="sidebarIEPadder">
				[search box here]
			{% include "tags/category_list.html" %}
		<div id="content">
			<a name="content"></a>
			<div class="contentIEPadder">
				{% block content %}{% endblock %}
	<div id="footer">
		<div class="footerIEPadder">
			[footer here]
{% endblock %}

and this is my category .html file

{% extends "catalog.html" %}
{% block content %}
	<h1>{{ }}</h1>
	{{ c.description }}
	{% for p in products %}
		<div class="product_thumbnail">
			<a href="{{ p.get_absolute_url }}">
				<img src="{{ MEDIA_URL }}images/products/thumbnails/{{ 

p.image }}" 
								alt="{{ }}" 

				{{ }}
	{% endfor %}
{% endblock %}

and this is my product.html file

{% extends "catalog.html" %}

{% block content %}
	<div class="product_image">
		<img src="{{ MEDIA_URL }}images/products/main/{{ p.image }}" alt="{{ }}"/> 
	<h1>{{ }}</h1>
	Brand: <em>{{ p.brand }}</em>
	SKU: {{ p.sku }}
	In categor{{ categories.count|pluralize:"y,ies" }}:
		{% for c in categories %}
	<a href="{{ c.get_absolute_url }}">{{ }}</a>
		{% if not forloop.last %},{% endif %}
				{% endfor %}
	{% if p.sale_price %}
			Was: <del> $ {{ p.old_price }} </del>
			Now: $ {{ p.price }}
	{% else %}
Price: $ {{ p.price }}
	{% endif %}
		[add to cart button]
	<div class="cb"><br/><br/></div>
	<h3>Product Description</h3>
		{{ p.description }}
{% endblock %}

so please help me and fix that problem for me although i know that the error in template 

file but i could,t able to fix it 

More information about the Python-list mailing list