【发布时间】:2017-11-09 06:43:33
【问题描述】:
我试图在我的 django 应用程序中的 html 模板中放置一个图像,但它没有显示。当我检查时,它说图像无法加载。
HTML 代码:
<div class = "col-md-4">
<img src= "/static/images/abc.jpg" alt="sorry"/>
</div>
图片 abc.png 的位置是 /home/user/demo/mysite/mysite/static/images/abc.png 我的 django 应用程序是位于 mysite(demo/mysite) 中的书签
这是在 django 应用程序中提供路径的正确方法还是需要做其他事情。
.
└── mysite
├── bookmark
│ ├── admin.py
│ ├── admin.pyc
│ ├── apps.py
│ ├── forms.py
│ ├── forms.pyc
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── migrations
│ │ ├── 0001_initial.py
│ │ ├── 0001_initial.pyc
│ │ ├── 0002_auto_20171029_1436.py
│ │ ├── 0002_auto_20171029_1436.pyc
│ │ ├── 0003_userbookmark.py
│ │ ├── 0003_userbookmark.pyc
│ │ ├── __init__.py
│ │ └── __init__.pyc
│ ├── models.py
│ ├── models.pyc
│ ├── static
│ │ └── style.css
│ ├── templates
│ │ ├── 20150225_134637.jpg
│ │ ├── abc.jpg
│ │ ├── base_generic.html
│ │ ├── category.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── myprofile.html
│ │ ├── profile.html
│ │ ├── register2.html
│ │ ├── register.html
│ │ ├── registerInterest.html
│ │ ├── sample
│ │ └── success.html
│ ├── tests.py
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ └── views.pyc
├── db.sqlite3
├── manage.py
├── mysite
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings.py
│ ├── settings.pyc
│ ├── static
│ │ └── images
│ │ ├── abc.jpg
│ │ └── icons_core-88916797fd4fde57d4120dea4c239f1d@1x.png
│ ├── urls.py
│ ├── urls.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
└── urls.py
我已经编辑了帖子并添加了我的项目的树结构
【问题讨论】:
-
也许你的项目树会有所帮助..
-
@AaronVisang 我已经编辑了我的问题并添加了我的项目的树结构