<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Settings — django-staticfiles v0.3.1 documentation</title> <link rel="stylesheet" href="_static/nature.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '', VERSION: '0.3.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="top" title="django-staticfiles v0.3.1 documentation" href="index.html" /> <link rel="next" title="Changelog" href="changelog.html" /> <link rel="prev" title="Helpers" href="helpers.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="changelog.html" title="Changelog" accesskey="N">next</a> |</li> <li class="right" > <a href="helpers.html" title="Helpers" accesskey="P">previous</a> |</li> <li><a href="index.html">django-staticfiles v0.3.1 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="settings"> <h1>Settings<a class="headerlink" href="#settings" title="Permalink to this headline">¶</a></h1> <div class="section" id="static-root"> <h2><tt class="docutils literal"><span class="pre">STATIC_ROOT</span></tt><a class="headerlink" href="#static-root" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">''</span></tt> (Empty string)</td> </tr> </tbody> </table> <p>The absolute path to the directory that holds static files like app media:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">STATIC_ROOT</span> <span class="o">=</span> <span class="s">"/home/polls.com/polls/site_media/static/"</span> </pre></div> </div> <p>This is only used by the default static files storage (i.e. if you use a different <tt class="docutils literal"><span class="pre">STATICFILES_STORAGE</span></tt>, you don’t need to set this).</p> </div> <div class="section" id="static-url"> <span id="id1"></span><h2><tt class="docutils literal"><span class="pre">STATIC_URL</span></tt><a class="headerlink" href="#static-url" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">''</span></tt> (Empty string)</td> </tr> </tbody> </table> <p>URL that handles the files served from STATIC_ROOT, e.g.:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">STATIC_URL</span> <span class="o">=</span> <span class="s">'/site_media/static/'</span> </pre></div> </div> <p>Note that this should <strong>always</strong> have a trailing slash.</p> </div> <div class="section" id="staticfiles-dirs"> <span id="id2"></span><h2><tt class="docutils literal"><span class="pre">STATICFILES_DIRS</span></tt><a class="headerlink" href="#staticfiles-dirs" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">[]</span></tt></td> </tr> </tbody> </table> <p>This setting defines the additional locations the <tt class="docutils literal"><span class="pre">staticfiles</span></tt> app will traverse when looking for media files, e.g. if you use the <a class="reference internal" href="commands.html#build-static"><em>build_static</em></a> or <a class="reference internal" href="commands.html#resolve-static"><em>resolve_static</em></a> management command or use the static file serving view.</p> <p>It should be defined as a sequence of <tt class="docutils literal"><span class="pre">(prefix,</span> <span class="pre">path)</span></tt> tuples, e.g.:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">STATICFILES_DIRS</span> <span class="o">=</span> <span class="p">(</span> <span class="p">(</span><span class="s">''</span><span class="p">,</span> <span class="s">'/home/special.polls.com/polls/media'</span><span class="p">),</span> <span class="p">(</span><span class="s">''</span><span class="p">,</span> <span class="s">'/home/polls.com/polls/media'</span><span class="p">),</span> <span class="p">(</span><span class="s">'common'</span><span class="p">,</span> <span class="s">'/opt/webfiles/common'</span><span class="p">),</span> <span class="p">)</span> </pre></div> </div> </div> <div class="section" id="staticfiles-prepend-label-apps"> <h2><tt class="docutils literal"><span class="pre">STATICFILES_PREPEND_LABEL_APPS</span></tt><a class="headerlink" href="#staticfiles-prepend-label-apps" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">('django.contrib.admin',)</span></tt></td> </tr> </tbody> </table> <p>A sequence of app paths that should be prefixed with the label name. For example, <tt class="docutils literal"><span class="pre">django.contrib.admin</span></tt> media files should be served from <tt class="docutils literal"><span class="pre">admin/[js,css,images]</span></tt> rather than the media files getting served directly from the static root.</p> </div> <div class="section" id="staticfiles-media-dirnames"> <h2><tt class="docutils literal"><span class="pre">STATICFILES_MEDIA_DIRNAMES</span></tt><a class="headerlink" href="#staticfiles-media-dirnames" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">('media',)</span></tt></td> </tr> </tbody> </table> <p>A sequence of directory names to be used when searching for media files in installed apps, e.g. if an app has its media files in <tt class="docutils literal"><span class="pre"><app>/static</span></tt> use:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">STATICFILES_MEDIA_DIRNAMES</span> <span class="o">=</span> <span class="p">(</span> <span class="s">'media'</span><span class="p">,</span> <span class="s">'static'</span><span class="p">,</span> <span class="p">)</span> </pre></div> </div> </div> <div class="section" id="staticfiles-excluded-apps"> <h2><tt class="docutils literal"><span class="pre">STATICFILES_EXCLUDED_APPS</span></tt><a class="headerlink" href="#staticfiles-excluded-apps" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">[]</span></tt></td> </tr> </tbody> </table> <p>A sequence of app paths that should be ignored when searching for media files:</p> <div class="highlight-python"><div class="highlight"><pre><span class="n">STATICFILES_EXCLUDED_APPS</span> <span class="o">=</span> <span class="p">(</span> <span class="s">'annoying.app'</span><span class="p">,</span> <span class="s">'old.company.app'</span><span class="p">,</span> <span class="p">)</span> </pre></div> </div> </div> <div class="section" id="staticfiles-storage"> <span id="id3"></span><h2><tt class="docutils literal"><span class="pre">STATICFILES_STORAGE</span></tt><a class="headerlink" href="#staticfiles-storage" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">'staticfiles.storage.StaticFileStorage'</span></tt></td> </tr> </tbody> </table> <p>The storage to use for copying static files to a single location.</p> </div> <div class="section" id="staticfiles-resolvers"> <h2><tt class="docutils literal"><span class="pre">STATICFILES_RESOLVERS</span></tt><a class="headerlink" href="#staticfiles-resolvers" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field"><th class="field-name">Default:</th><td class="field-body"><tt class="docutils literal"><span class="pre">('staticfiles.resolvers.FileSystemResolver',</span> <span class="pre">'staticfiles.resolvers.AppDirectoriesResolver',</span> <span class="pre">'staticfiles.resolvers.LocalStorageResolver')</span></tt></td> </tr> </tbody> </table> <p>The list of resolver classes that know how to find static files in various locations.</p> <p>If you know you only keep your files in one of those locations, just omit the unnecessary resolvers.</p> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">Settings</a><ul> <li><a class="reference internal" href="#static-root"><tt class="docutils literal"><span class="pre">STATIC_ROOT</span></tt></a></li> <li><a class="reference internal" href="#static-url"><tt class="docutils literal"><span class="pre">STATIC_URL</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-dirs"><tt class="docutils literal"><span class="pre">STATICFILES_DIRS</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-prepend-label-apps"><tt class="docutils literal"><span class="pre">STATICFILES_PREPEND_LABEL_APPS</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-media-dirnames"><tt class="docutils literal"><span class="pre">STATICFILES_MEDIA_DIRNAMES</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-excluded-apps"><tt class="docutils literal"><span class="pre">STATICFILES_EXCLUDED_APPS</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-storage"><tt class="docutils literal"><span class="pre">STATICFILES_STORAGE</span></tt></a></li> <li><a class="reference internal" href="#staticfiles-resolvers"><tt class="docutils literal"><span class="pre">STATICFILES_RESOLVERS</span></tt></a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="helpers.html" title="previous chapter">Helpers</a></p> <h4>Next topic</h4> <p class="topless"><a href="changelog.html" title="next chapter">Changelog</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/settings.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="changelog.html" title="Changelog" >next</a> |</li> <li class="right" > <a href="helpers.html" title="Helpers" >previous</a> |</li> <li><a href="index.html">django-staticfiles v0.3.1 documentation</a> »</li> </ul> </div> <div class="footer"> © Copyright 2010, Jannis Leidel. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.2. </div> </body> </html>