<!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>Management Commands — 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="Helpers" href="helpers.html" /> <link rel="prev" title="django-staticfiles" href="index.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="helpers.html" title="Helpers" accesskey="N">next</a> |</li> <li class="right" > <a href="index.html" title="django-staticfiles" 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="management-commands"> <h1>Management Commands<a class="headerlink" href="#management-commands" title="Permalink to this headline">¶</a></h1> <div class="section" id="build-static"> <span id="id1"></span><h2>build_static<a class="headerlink" href="#build-static" title="Permalink to this headline">¶</a></h2> <p>Collects the media files from all installed apps and copies them to the <a class="reference internal" href="settings.html#staticfiles-storage"><em>STATICFILES_STORAGE</em></a>.</p> <p>You can limit the apps parsed by providing a list of app names:</p> <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> python manage.py build_static --exclude-dirs admin polls </pre></div> </div> <p>Duplicate file names are resolved in a similar way to how template resolution works. Files are initially searched for in <a class="reference internal" href="settings.html#staticfiles-dirs"><em>STATICFILES_DIRS</em></a> locations, followed by apps in the order specified by the INSTALLED_APPS setting.</p> <p>Some commonly used options are:</p> <ul> <li><dl class="first docutils"> <dt><tt class="docutils literal"><span class="pre">--noinput</span></tt></dt> <dd><p class="first last">Do NOT prompt the user for input of any kind.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt><tt class="docutils literal"><span class="pre">-i</span> <span class="pre">PATTERN</span></tt> or <tt class="docutils literal"><span class="pre">--ignore=PATTERN</span></tt></dt> <dd><p class="first last">Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt><tt class="docutils literal"><span class="pre">-n</span></tt> or <tt class="docutils literal"><span class="pre">--dry-run</span></tt></dt> <dd><p class="first last">Do everything except modify the filesystem.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt><tt class="docutils literal"><span class="pre">-l</span></tt> or <tt class="docutils literal"><span class="pre">--link</span></tt></dt> <dd><p class="first last">Create a symbolic link to each file instead of copying.</p> </dd> </dl> </li> <li><dl class="first docutils"> <dt><tt class="docutils literal"><span class="pre">--exclude-dirs</span></tt></dt> <dd><p class="first last">Exclude additional static locations specified in the <a class="reference internal" href="settings.html#staticfiles-dirs"><em>STATICFILES_DIRS setting</em></a>.</p> </dd> </dl> </li> </ul> <p>For a full list of options, refer to the build_static management command help by running:</p> <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> python manage.py build_static --help </pre></div> </div> </div> <div class="section" id="resolve-static"> <span id="id2"></span><h2>resolve_static<a class="headerlink" href="#resolve-static" title="Permalink to this headline">¶</a></h2> <p>Resolves one or more expected relative URL path to absolute paths of each media file on the filesystem. For example:</p> <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> python manage.py resolve_static css/base.css admin/js/core.css <span class="go">/home/special.polls.com/core/media/css/base.css</span> <span class="go">/home/polls.com/core/media/css/base.css</span> <span class="go">/home/polls.com/src/django/contrib/admin/media/js/core.js</span> </pre></div> </div> <p>By default, all matching locations are found. To only return the first match for each relative path, use the <tt class="docutils literal"><span class="pre">--first</span></tt> option:</p> <div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> python manage.py resolve_static css/base.css --first <span class="go">/home/special.polls.com/core/media/css/base.css</span> </pre></div> </div> </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="#">Management Commands</a><ul> <li><a class="reference internal" href="#build-static">build_static</a></li> <li><a class="reference internal" href="#resolve-static">resolve_static</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="index.html" title="previous chapter">django-staticfiles</a></p> <h4>Next topic</h4> <p class="topless"><a href="helpers.html" title="next chapter">Helpers</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/commands.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="helpers.html" title="Helpers" >next</a> |</li> <li class="right" > <a href="index.html" title="django-staticfiles" >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>