title: NGINX not finding static files in Dockered Django project
body: <p>I'm new to using Docker and Nginx. I'm taking a project I have working locally which includes flatpages and a couple of simple apps and combining it with <a href="https://pawamoy.github.io/2018/02/01/docker-compose-django-postgres-nginx.html" rel="nofollow noreferrer">this guide to utilise Docker, NGINX and Gunicorn</a>.</p>
  
  <p>For some reason, it can't find my Static files or even the standard Django  admin static files.</p>
  
  <p><strong>Console error</strong></p>
  
  <pre><code>GET http://0.0.0.0:8000/static/flatpages/CSS/flatpages.css 
  net::ERR_ABORTED 404 (Not Found)
  </code></pre>
  
  <p><strong>Django Admin</strong>
  <a href="https://i.stack.imgur.com/gMErm.png" rel="nofollow noreferrer">Django Admin</a></p>
  
  <p><strong>local.conf</strong></p>
  
  <pre><code>upstream hello_server {
      server djangoapp:8000;
  }
  
  server {
  
      listen 80;
      server_name localhost;
  
      location / {
          proxy_pass http://hello_server;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $host;
          proxy_redirect off;
      }
  
      location /static/ {
          autoindex on;
          alias /opt/services/djangoapp/static/;
      }
  
      location /media/ {
          alias /opt/services/djangoapp/media/;
      }
  }
  </code></pre>
  
  <p><strong>settings.py</strong></p>
  
  <pre><code>BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  
  STATIC_URL = '/static/'
  
  STATICFILES_DIRS = [
      os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), 
      "static"),
      '/static/flatpages/',
  ]  
  </code></pre>
  
  <p>Amongst many other things, so far I've tried:</p>
  
  <ul>
  <li>Using STATIC_ROOT and STATICFILES_DIRS
  
  <ul>
  <li>My understanding from the Django docs is that with static files in<br>
  multiple locations I need to use STATICFILES_DIRS</li>
  <li>If I use STATIC_ROOT and collect static the Django Admin does find 
  the static files but won't find any others.</li>
  </ul></li>
  <li>Navigating the apps Docker container to find the files manually. I 
  can't locate them or any of the templates that do work. I find this 
  very odd. </li>
  </ul>
  
  <p>Please let me know if I need to clarify or include anything else. Thanks in advance for any help, it's really appreciated.</p>