Django STATIC_URL is empty, images doesn't show

后端 未结 2 1575
清酒与你
清酒与你 2021-01-28 21:13

I know that there is plenty of questions like that, I read them all and tried everything, however nothing solved my problem.

I\'m writing something like blog in Django

2条回答
  •  一个人的身影
    2021-01-28 21:28

    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:

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

提交回复
热议问题