0

models.py

class Post(models.Model):
    image = models.FileField(upload_to='note/static/note/')`

template

<img src={{note.image.url}}

error:

[14/May/2021 08:42:07] "GET / HTTP/1.1" 200 402

Not Found: /note/static/note/test.png

[14/May/2021 08:42:07] "GET /note/static/note/test.png HTTP/1.1" 404 2357

Did I do anything wrong?

Ivan Starostin
  • 8,798
  • 5
  • 21
  • 39

1 Answers1

0

You will have to use the static template tag. Something like this

{% load static %}

<img src="{% static 'note/test.png'%}">

More to this can be found here https://docs.djangoproject.com/en/3.2/howto/static-files/

Geofrey Asiimwe
  • 202
  • 3
  • 9