How to access image folder in django

Posted by anc1revv on Stack Overflow See other posts from Stack Overflow or by anc1revv
Published on 2012-07-07T02:20:16Z Indexed on 2012/07/07 3:16 UTC
Read the original article Hit count: 145

Filed under:
|

I just started django and i want to access images uploaded by a user.

here is my model:

class Food(models.Model):
    name = models.CharField(max_length=100)
    price = models.DecimalField(max_digits=4, decimal_places=2)
    quantity = models.IntegerField(blank=True, null=True)
    description = models.CharField(max_length=200)
    location = models.CharField(max_length=100)
    time = models.DateTimeField()
    photo_thumbnail = models.ImageField(upload_to="images")
    photo_fullsize = models.ImageField(upload_to="images")

i stored the image in the "images" folder below

enter image description here

the html is this:

img src="{{steak.photo_thumbnail}}"

and

steak.photo_thumbnail = images/steak_and_egg_thumbnail_1.png 

here is the error i get:

[06/Jul/2012 19:08:24] "GET /menu/ HTTP/1.1" 200 99
[06/Jul/2012 19:08:24] "GET /menu/images/steak_and_egg_thumbnail_1.png HTTP/1.1" 404 2127

© Stack Overflow or respective owner

Related posts about django

Related posts about imagefield