0

I'm trying to link some pictures to my Django app from the static folder, but instead it creates a new static folder inside the templates directory.

My HTML:

{% load static %}
<!DOCTYPE html>
{% extends 'milk_app/base.html' %}

{% load staticfiles %} 


{% block title_block %}
    Homepage
    

{% endblock %}

{% block body_block %}

<!-- Home page for Hosts -->
{% if user.userprofile.account == "Host" %}
    <div class="container">
        <div class="row">
            
            <div class="home_hover_pictures col-4">
                <a href="home.php"><img class="img-responsive" src="{% static 'images/listing-property.jpg' %}"></a>
                <h4>Create a new listing</h4>
            </div>
            
            <div class="home_hover_pictures col-4">
                <a href="home.php"><img class="img-responsive" src="{% static 'images/your-properties.jpg' %}"></a>
                <h4>Show your rented properties</h4>
            </div>

            <div class="home_hover_pictures col-4">
                <a href="home.php"><img class="img-responsive" src="{% static 'images/scroll-others.jpg' %}"></a>
                <h4>Scroll other properties</h4>
            </div>
        </div>
    </div>

<!-- Home page for Tenants (not the beer) -->
{% elif user.userprofile.account == 'Tenant' %}

<!-- Home page for not logged users -->
{% else %}
<br><br>    
    <section >
        <div>
            
        </div>
    </section>
    
{% endif %}


{% endblock %}

My folder looks like this:

 1. APP_APP
 2. ACTUALAPP
 3. STATIC
        * images
              - the actual images.jpgs
 4. TEMPLATES
        * creating a new **{% static 'images** folder
              - creating a new image here

So my VS Code is creating a new file somewhere I don't want to create it with also creating a new .jpg file which does not make sense. Why does it to that?

Ivan Starostin
  • 8,798
  • 5
  • 21
  • 39

1 Answers1

0

As it says in the docs, you can define a list of directories (STATICFILES_DIRS) in your settings if you assets aren’t tied to a particular app

STATICFILES_DIRS = [
    BASE_DIR / "static"
]
sanNeck
  • 148
  • 7