title: Django not serving static files in production
body: <p><strong>settings.py:</strong></p>
  
  <pre><code>DEBUG = False
  
  STATIC_ROOT = '/opt/app/statics/'
  
  # URL prefix for static files.
  # Example: "http://example.com/static/", "http://static.example.com/"
  STATIC_URL = '/statics/'
  
  # Additional locations of static files
  STATICFILES_DIRS = (os.path.join(BASE_DIR, 'statics'),)
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.contrib.staticfiles.urls import staticfiles_urlpatterns
  import settings
  
  if settings.DEBUG == True:
      urlpatterns += staticfiles_urlpatterns()
  </code></pre>
  
  <p><strong>/etc/nginx/sites-available/app</strong></p>
  
  <pre><code>server {
      server_name xxx.xxx.xxx.xxx;
  
      access_log on;
  
      location /statics/ {
          alias /opt/app/statics/;
      }
  
      location / {
          proxy_pass http://127.0.0.1:8000;
          proxy_set_header X-Forwarded-Host $server_name;
          proxy_set_header X-Real-IP $remote_addr;
          add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
      }
  }
  </code></pre>
  
  <p><strong>/etc/nginx/sites-enabled/app is exactly the same as in sites-available</strong>
  Folder with static files has been granted with highest possible privileges ( chmod 777 ).</p>
  
  <p>Whenever I try to run the server with command:</p>
  
  <pre><code>gunicorn -b 0.0.0.0:8000 example.wsgi:application
  </code></pre>
  
  <p>It actually runs the server, but do not redirect correctly to static files </p>