From 2ce4c70dbe3830fa41e14d12a9b0fe681ef81c12 Mon Sep 17 00:00:00 2001 From: James Smith <smithy@Jamess-MacBook-Air.local> Date: Mon, 26 Feb 2024 17:07:39 +0000 Subject: [PATCH] moved images to static folder, adjusted src code to point to image per django documentation recommended way --- .../src}/images/0_IPKn3dedq86U4UqP.png | Bin myproject/myapp/templates/index.html | 3 ++- myproject/myproject/settings.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) rename myproject/myapp/{templates => static/src}/images/0_IPKn3dedq86U4UqP.png (100%) diff --git a/myproject/myapp/templates/images/0_IPKn3dedq86U4UqP.png b/myproject/myapp/static/src/images/0_IPKn3dedq86U4UqP.png similarity index 100% rename from myproject/myapp/templates/images/0_IPKn3dedq86U4UqP.png rename to myproject/myapp/static/src/images/0_IPKn3dedq86U4UqP.png diff --git a/myproject/myapp/templates/index.html b/myproject/myapp/templates/index.html index f674ffd..bd101b7 100644 --- a/myproject/myapp/templates/index.html +++ b/myproject/myapp/templates/index.html @@ -12,7 +12,8 @@ </p> </div> <div class="grid grid-cols-2 gap-4 mt-8"> - <img class="w-full rounded-lg" src="./images/0_IPKn3dedq86U4UqP.png" alt="CNN for audio"> + {% load static %} + <img class="w-full rounded-lg" src="{% static 'src/images/0_IPKn3dedq86U4UqP.png' %}" alt="CNN for audio"> </div> </div> <div class="gap-16 items-center py-8 px-4 mx-auto max-w-screen-xl lg:grid lg:grid-cols-2 lg:py-16 lg:px-6"> diff --git a/myproject/myproject/settings.py b/myproject/myproject/settings.py index 15fc0bb..860b534 100644 --- a/myproject/myproject/settings.py +++ b/myproject/myproject/settings.py @@ -139,3 +139,5 @@ STATIC_URL = 'static/' # https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' + +IMAGE_URL = 'static/src/images/' -- GitLab