Can't load Django static files in view
<p>I'm a new player in Django and Python. I want to load the static files from the project level static folder. The problem is I can't but I still can load the static of an app.
This is the structure of my project:</p>

<pre><code>Yaas
    __init__.py
    settings.py
    urls.py
    wsgi.py
    templates
        base.html
    static
        style.css
    auction
        templates
            auction
                index.html
        static
            auction
                style.css
        __init__.py
        apps.py
        models.py
        urls.py
        views.py
</code></pre>

<p>The thing is it works with static file of auction, like this in base.html:</p>

<pre><code>{% load static %}
&lt;link rel="stylesheet" type="text/css" href="{% static 'auction/style.css' %}" /&gt;
</code></pre>

<p>But it returns 404 with the project static file:</p>

<pre><code>{% load static %}
&lt;link rel="stylesheet" type="text/css" href="{% static 'style.css' %}" /&gt;
</code></pre>

<p>settings.py</p>

<pre><code>STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")
</code></pre>

<p>I tried other solutions and document on Django but it still didn't work. I am using Django 1.10.</p>

<p>I made this work by adding the following:</p>

<pre><code>STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
</code></pre>

<p>From the <a href="https://docs.djangoproject.com/en/1.10/howto/static-files/#configuring-static-files" rel="nofollow">docs</a> (after point 4):</p>

<blockquote>
  <p>Your project will probably also have static assets that arenât tied to
  a particular app. In addition to using a static/ directory inside your
  apps, you can define a list of directories (STATICFILES_DIRS) in your
  settings file where Django will also look for static files.</p>
</blockquote>

<p>Please note that the <code>STATIC_ROOT</code> directory, where Django will output all collected static files found in each <code>&lt;app&gt;/static</code> and <code>STATICFILES_DIRS</code> directories, must be different.</p>

<p>Hope that helps!</p>

python django