Thursday, July 31, 2014

image upload

i have a problem of displaying my image on my web page.

i have upload my pic in admin and when i display it it shows me the  this

media/Lighthouse_1.jpg

models.py

class Image(models.Model):
    title = models.CharField(max_length=60, blank=True, null=True)
    image = models.FileField(upload_to="images")


<div id="content">
<div id="content_plate">

<h2> {{ blogs.title }} - Date Published: {{blogs.pub_date}} </h2>
<p> {{ blogs.content|safe}} <br />Tags: {{ blogs.photo }}</p> 
<h2> Reported By: {{blogs.reporter}} </h2>
</div>
<div id='link_back'>
<ul>
<p>Return back to Main Page</p>
<li><a href="/blog/">News</a></li>
</ul>
 
</div>
{% endblock %}




MEDIA_ROOT = 'C:/Python27/Scripts/testproject/Django-1.4.3/django/bin/test0/images/'
MEDIA_URL = '/media/'

STATIC_ROOT = '' "
STATIC_URL = '/static/'







--
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 django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/ee0a99c1-b4aa-47fd-9e19-6937e2c0d705%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment