Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>If you want just a solution - scroll down to the "Solution".</strong></p> <h2>Overview</h2> <p>I was discovering the same problem yesterday. Here is what I found:</p> <p>All you need is appropriate static finder, that will find your STATIC_ROOT and all its contents, but there is no such finder. Here are default finders:</p> <ul> <li><p><em>django.contrib.staticfiles.finders.AppDirectoriesFinder</em> - search installed django applications dirs for 'static' folder, but most of them use obsolete 'media' folders for now.</p></li> <li><p><em>django.contrib.staticfiles.finders.FileSystemFinder</em> - use all dirs mentioned in the STATICFILES_DIRS, but you can't add STATIC_ROOT into it.</p></li> <li><p><em>django.contrib.staticfiles.finders.DefaultStorageFinder</em> - search static in your DEFAULT_FILE_STORAGE which is <em>django.core.files.storage.FileSystemStorage</em> by default and it points to your MEDIA_ROOT</p></li> </ul> <h2>Solution</h2> <p>That's all, no additional choices. There are no choices to use STATIC_ROOT for now (in Django 1.3). <br/> So I've just wrote my own custom finder for these needs:</p> <ul> <li><p>My custom static finder file: <strong>finders.py</strong>:</p> <pre><code>from django.core.files.storage import FileSystemStorage from django.contrib.staticfiles.finders import BaseStorageFinder from django.conf import settings class StaticFinder(BaseStorageFinder): storage = FileSystemStorage(settings.STATIC_ROOT, settings.STATIC_URL) </code></pre></li> <li><p><strong>settings.py</strong>:</p> <pre><code>STATICFILES_FINDERS = ( 'finders.StaticFinder', ) </code></pre></li> <li>If you want to use it with another finders - I suggest to put them after it inside STATICFILES_FINDERS</li> </ul> <p><strong>And remember</strong>: this solution should be used only in development needs and never on production!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload