Thanks a lot.

I do the following steps:
aggregate an alias to the virtual host of my site:
Alias /media /var/www/fourweb/media/

and modified:

settings.MEDIA_ROOT = '/var/www/fourweb/media/'
settings.MEDIA_URL = 'http://fourweb.com/media/'

it works!.

Cheers
Ronny

El martes, 21 de mayo de 2013 21:10:24 UTC-4, Ronny Villarroel Mendoza 
escribió:
>
> Hi all,
>
> I cant show the picture that I upload from the admin site.
>
>
> settings.py:
>
> MEDIA_ROOT = '/var/www/fourweb/'
>
>
>
> models.py:
>
> class picture(models.Model):
>     producto_id = models.ForeignKey(producto)
>     description = models.CharField(max_length= 250)
>     imagen = models.ImageField(upload_to='photos/%Y/%m/%d', help_text = 
> '100px,150px')
>     def __unicode__(self):
>         return self.description
>
>
>
> view.py:
>
> def detail(request, item_id):
>     p = get_object_or_404(producto, pk=item_id)
>     pictures = picture.objects.filter(producto_id = item_id)
>     return render_to_response('detail.html', {'item': p, 'photos': 
> pictures })
>
> and in the tamplate(details.html):
>
>
>    {% if photos %}
>                 {% for photo in photos %}
>                         <img src="{{ photo.imagen.url }}" height="200" 
> width="200" >
>                 {% endfor %}
>    {% else %}
>                 <p>No hay imagen para el articulo</p>
>    {% endif %}
>
> the last html output code is:
>
> <img 
> src="photos/2013/05/14/picture_67090.jpg<http://fourweb.com/tienda/2/photos/2013/05/14/picture_67090.jpg>"
>  
> height="200" width="200" >
>
> the problem is that the picture doen't show, the path is broken. What I 
> doing wrong ???.
>
> please your help.
>
> Regards,
> Ronny 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to