It is :
STATICFILES_DIRS=[
.....
]
Not :
STATICFILES_DIR=[
.....
]
Just add S in the end of DIR like DIRS and make sur u create static folder
in your project root.
Le jeu. 15 juin 2023 à 16:52, Ngaga Dancan <[email protected]> a
écrit :
> Use load static first before you use extends
>
>
> On Thu, Jun 15, 2023, 16:52 Prosper Lekia <[email protected]> wrote:
>
>> Where is the Python.png located?
>>
>> From your code, it should be directly in your static folder not a
>> subfolder. So verify your file structure first. If every is in order,
>> confirm if whitenoise is installed, and been added to your MiddleWare.
>>
>> On Thu, Jun 15, 2023, 14:33 Aspersh Upadhyay <
>> [email protected]> wrote:
>>
>>> my settings.py
>>>
>>> STATIC_URL = 'static/'
>>>
>>> STATICFILES_DIR = [
>>> BASE_DIR / "static"
>>> ]
>>>
>>> Template where I am trying to load static files
>>>
>>> {% extends 'base.html' %}
>>> {% load static %}
>>>
>>> {% block title %}
>>> Issue With Django static files
>>> {%endblock title %}
>>> {% block body %}
>>> <body class="bg-gray-50 font-serif leading-normal tracking-normal">
>>> <div class="lg:max-w-lg lg:w-full md:w-1/2 w-5/6 mb-10 md:mb-0">
>>> <img class="object-cover object-center rounded" alt="hero"
>>> src="{% static 'Python.png' %}">
>>> </div>
>>> </body>
>>>
>>> terminal throwing me 404 see this 👇👇
>>>
>>> "GET /static/Python.png HTTP/1.1" 404 1789
>>>
>>> I hope here I will get my solution for this.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/54b813cc-58f4-4cbe-80af-a427f063fbb2n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/54b813cc-58f4-4cbe-80af-a427f063fbb2n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CALGeGE2kXEJ77bEAQY-eQA588PAJsM2ssUicpJsDrxdz8V2g_A%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CALGeGE2kXEJ77bEAQY-eQA588PAJsM2ssUicpJsDrxdz8V2g_A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAAzh8pK%3DxH0GTm2MdLi1bwD%3DU8u%3D9z5MEf3os1qBNyVzWKCtvg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAAzh8pK%3DxH0GTm2MdLi1bwD%3DU8u%3D9z5MEf3os1qBNyVzWKCtvg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/CABePkdaZWAUt6hoM2LBD2mGSvO%3D-gLQ77DK2Cf1fSFNzNvzkBw%40mail.gmail.com.