Django STATIC_URL is empty, images doesn't show

喜夏-厌秋 提交于 2019-12-02 10:59:52

It appears that you need to refer to MEDIA instead of STATIC in this case.

Take a look at your MEDIA_ROOT and MEDIA_URL in settings to ensure they're pointed to the right place.

Then, in your template, you can get the URL for the object via the attribute:

<img src="{{ comment.author.picture.url }}" width="70px" height="70px">

More on MEDIA in the docs: https://docs.djangoproject.com/en/1.9/ref/settings/#std:setting-MEDIA_ROOT

Try changing MEDIA_URL to '/static/users/'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!