title: Static files loading in production but not development
body: <p>Usually I have this issue exactly the other way around!</p>
  
  <p>In my development environment my Django app will not load some of my static files, specifically ones that I have added myself: that is, the two packages I've added to my app (<code>admin</code> and <code>ckeditor</code>) are both loading up fine, but two of the folders I've created and linked myself (<code>img</code> and <code>css</code>) are not being found. Here's a map of my directory:</p>
  
  <pre><code>root
   |-- blog    (this is the name of my app)
   |-- mysite  (name of my site)
        |-- settings.py
        |-- urls.py
   |-- media
   |-- static
        |-- admin
        |-- ckeditor
        |-- css
        |-- img
  </code></pre>
  
  <p>As stated, <code>ckeditor</code> and <code>admin</code> load fine while the others do not. Here's an example from the <code>runserver</code> output in debug mode (the file at <code>static/css/base.css</code> exists in my file tree):</p>
  
  <pre><code>GET /static/ckeditor/ckeditor/ckeditor.js HTTP/1.1" 200 690627
  GET /static/admin/css/fonts.css HTTP/1.1" 200 423
  GET /static/admin/css/widgets.css HTTP/1.1" 200 10340
  GET /static/css/base.css HTTP/1.1" 404 1761
  GET /static/img/brand.png HTTP/1.1" 404 1764
  </code></pre>
  
  <p>Here's some other information which may be of interest:</p>
  
  <ul>
  <li>It works fine in production! I assumed this was because I had dedicated aliases in my apache config, but that doesn't explain why <code>admin</code> and <code>ckeditor</code> work.</li>
  <li>I have routed media in much the same way (see the settings file below) and that works fine in development.</li>
  <li>I am using the template tag <code>{% load static %}</code> as instructed by the Django docs. In older versions I used <code>{% load staticfiles %}</code> and I've tried that too.</li>
  <li>I have run <code>collectstatic</code> in both environments.</li>
  <li>Running with <code>DEBUG=False</code> works fine in production (all the static files load) but no static files load at all when <code>DEBUG=False</code> in development. This is to be expected though, since in development I don't have a web server to handle this (to clarify, I <em>usually</em> run the server in debug mode, but have tried turning this setting off and on to see what changes occur)</li>
  </ul>
  
  <p>In an effort to help anyone debug my problem, here are some relevant excerpts files:</p>
  
  <p><strong>settings.py</strong></p>
  
  <pre><code>DEBUG = True
  BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
  ...
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'blog',
      'ckeditor',
      'ckeditor_uploader',
  ]
  ...
  STATIC_ROOT = os.path.join(BASE_DIR, 'static')
  STATIC_URL = '/static/'
  MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
  MEDIA_URL = '/media/'
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path, include
  from django.conf import settings
  from django.conf.urls.static import static
  
  urlpatterns = [
      path('', include('blog.urls')),
      path('admin/', admin.site.urls),
      path('ckeditor', include('ckeditor_uploader.urls')),
  ]
  urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
  urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
  </code></pre>