Can't load image in my django template

左心房为你撑大大i 提交于 2019-12-07 13:47:26

For the given directory structure, You can put your static files on same level as of the directory with file, mr_doorbeen/settings.py

mrdoorbeen
manage.py
    mr_doorbeen
      setting.py
    mrdoorbeen
      migrations
      templates
         index.html
         profile
             profile.html
    static/

You can set the static files to the said location as follows.

# Static files configurations.
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')

The problem is with your settings file where you need to define STATIC_URL. Just follow the description in Django's documentation.

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