Reputation: 8111
Whenever I visit the path for an uploaded image in the admin, I get a 404. The image is successfully uploaded in the specified path but I don't know what URL structure to use to access the image. There is not URL structure specified yet for the image (that's what I want to know, or am I missing anything else?). Here are the details:
My models.py
class Product(models.Model):
category = models.ForeignKey('CatalogCategory', related_name='products')
name = models.CharField(max_length=300)
slug = models.SlugField(max_length=150)
description = models.ImageField(upload_to='product_photo', blank=True)
manufacturer = models.CharField(max_length=300, blank=True)
price_in_dollars = models.DecimalField(max_digits=6, decimal_places=2)
this is the error:
Request URL: http://localhost:8000/admin/products/product/1/product_photo/soy_candles.jpg/ product object with primary key u'1/product_photo/soy_candles.jpg' does not exist.
this is the dir struct
product_photo
products
->templates
->models.py
->views.py
->...
manage.py
settings.py
urls.py
EDIT I have not touched the details regarding the admin on the settings
Upvotes: 2
Views: 2906
Reputation: 118528
Your MEDIA_URL
defines this.
You either have it defined to '' and the admin is generating a relative URL or you have it set to http://localhost:8000/admin/products/product/1/
which is unlikely :P
Upvotes: 4