Sunday, March 4, 2018

template syntax error

i created a model in which i have an image filed but when ever i am trying to get an uploaded image on the 
in my model.py 
image = models.ImageField(upload_to='static/pictures',)

setting.py
STATIC_URL = '/static/'
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static", "./static"),
'/var/www/static/',
]

index.html file

{% load static %}
<img src="{% static pictures/1.png %}>

my folder hierarchy 
site
 app
   static
static
 pictures #the one which is define in model







--
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5882b15f-d674-44b9-ba67-74eeecd39137%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment