私はdjangoアプリケーションでhtmlテンプレートに画像を入れようとしていますが、表示されません。私が調べると、イメージを読み込むことができないと言います。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
│ │ └── [email protected]
│ ├── urls.py
│ ├── urls.pyc
│ ├── wsgi.py
│ └── wsgi.pyc
└── urls.py
私はポストを編集したと
多分木のDjangoテンプレートで静的ファイルを使用するための正しい方法である私のプロジェクトのツリー構造を追加しましたあなたのプロジェクトの助けになるでしょう.. – Coder949
https://docs.djangoproject.com/en/1.11/howto/static-files/#serving-static-files-during-開発 – harmaahylje
[[静的フォルダからDjangoテンプレートに画像を追加する - Django](https://stackoverflow.com/questions/46602422/adding-an-image-into-a-django-template-from-the)の可能な複製-static-folder-django) – Satendra