views:

505

answers:

0

I'm developing using Django on Windows. I have a model with an imagefield, and use a form to fill it. Images get uploaded without problem. The problem occurs when I attempt to show an uploaded image inside a template by coding this:

<img src ='{{object.image.url}}'/>

(object is an instance of the relevant model, and image is the name of the image field)

However, the image is not displayed, as the url method returns not a URL but a path like this:

c:/pp/pm/static/image/xyz.png

What should I do to make it a real URL?

edit:

MEDIA_ROOT and MEDIA_URL settings are below:

MEDIA_ROOT = 'C:/pp/pm/static/'
MEDIA_URL = '/static/'