<!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="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Reference — django-appconf 1.0.2 documentation</title> <link rel="stylesheet" href="_static/classic.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></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> <script type="text/javascript" src="_static/language_data.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="Changelog" href="changelog.html" /> <link rel="prev" title="Usage" href="usage.html" /> </head><body> <div class="related" role="navigation" aria-label="related navigation"> <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="usage.html" title="Usage" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">django-appconf 1.0.2 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="reference"> <h1>Reference<a class="headerlink" href="#reference" title="Permalink to this headline">¶</a></h1> <dl class="class"> <dt id="appconf.AppConf"> <em class="property">class </em><code class="descclassname">appconf.</code><code class="descname">AppConf</code><a class="headerlink" href="#appconf.AppConf" title="Permalink to this definition">¶</a></dt> <dd><p>A representation of a template tag. For example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyAppConf</span><span class="p">(</span><span class="n">AppConf</span><span class="p">):</span> <span class="n">SETTING_1</span> <span class="o">=</span> <span class="s2">"one"</span> <span class="n">SETTING_2</span> <span class="o">=</span> <span class="p">(</span> <span class="s2">"two"</span><span class="p">,</span> <span class="p">)</span> </pre></div> </div> <dl class="method"> <dt> <code class="descname">configure_*(value)</code></dt> <dd><p>Method for each of the app settings for custom configuration which gets the value passed of the class attribute or the appropriate override value of the <a class="reference internal" href="#appconf.AppConf.Meta.holder" title="appconf.AppConf.Meta.holder"><code class="xref py py-attr docutils literal notranslate"><span class="pre">holder</span></code></a> settings, e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyAppConf</span><span class="p">(</span><span class="n">AppConf</span><span class="p">):</span> <span class="n">DEPLOYMENT_MODE</span> <span class="o">=</span> <span class="s2">"dev"</span> <span class="k">def</span> <span class="nf">configure_deployment_mode</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> <span class="k">if</span> <span class="n">on_production</span><span class="p">():</span> <span class="n">value</span> <span class="o">=</span> <span class="s2">"prod"</span> <span class="k">return</span> <span class="n">value</span> </pre></div> </div> <p>The method <strong>must return</strong> the value to be use for the setting in question.</p> </dd></dl> <dl class="method"> <dt id="appconf.AppConf.configure"> <code class="descname">configure</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#appconf.AppConf.configure" title="Permalink to this definition">¶</a></dt> <dd><p>Hook for doing any extra configuration, returning a dictionary containing the configured data.</p> </dd></dl> <dl class="attribute"> <dt id="appconf.AppConf.configured_data"> <code class="descname">configured_data</code><a class="headerlink" href="#appconf.AppConf.configured_data" title="Permalink to this definition">¶</a></dt> <dd><p>The dictionary attribute which can be used to do any further custom configuration handling in the <a class="reference internal" href="#appconf.AppConf.configure" title="appconf.AppConf.configure"><code class="xref py py-meth docutils literal notranslate"><span class="pre">configure()</span></code></a> method, e.g. if multiple settings depend on each other.</p> </dd></dl> </dd></dl> <dl class="class"> <dt id="appconf.AppConf.Meta"> <em class="property">class </em><code class="descclassname">AppConf.</code><code class="descname">Meta</code><a class="headerlink" href="#appconf.AppConf.Meta" title="Permalink to this definition">¶</a></dt> <dd><p>An <code class="docutils literal notranslate"><span class="pre">AppConf</span></code> takes options via a <code class="docutils literal notranslate"><span class="pre">Meta</span></code> inner class:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">class</span> <span class="nc">MyAppConf</span><span class="p">(</span><span class="n">AppConf</span><span class="p">):</span> <span class="n">SETTING_1</span> <span class="o">=</span> <span class="s2">"one"</span> <span class="n">SETTING_2</span> <span class="o">=</span> <span class="p">(</span> <span class="s2">"two"</span><span class="p">,</span> <span class="p">)</span> <span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span> <span class="n">proxy</span> <span class="o">=</span> <span class="kc">False</span> <span class="n">prefix</span> <span class="o">=</span> <span class="s1">'myapp'</span> <span class="n">required</span> <span class="o">=</span> <span class="p">[</span><span class="s1">'SETTING_3'</span><span class="p">,</span> <span class="s1">'SETTING_4'</span><span class="p">]</span> <span class="n">holder</span> <span class="o">=</span> <span class="s1">'django.conf.settings'</span> </pre></div> </div> <dl class="attribute"> <dt id="appconf.AppConf.Meta.prefix"> <code class="descname">prefix</code><a class="headerlink" href="#appconf.AppConf.Meta.prefix" title="Permalink to this definition">¶</a></dt> <dd><p>Explicitly choose a prefix for all settings handled by the <code class="docutils literal notranslate"><span class="pre">AppConf</span></code> class. If not given, the prefix will be the capitalized class module name.</p> <p>For example, <code class="docutils literal notranslate"><span class="pre">acme</span></code> would turn into settings like <code class="docutils literal notranslate"><span class="pre">ACME_SETTING_1</span></code>.</p> </dd></dl> <dl class="attribute"> <dt id="appconf.AppConf.Meta.required"> <code class="descname">required</code><a class="headerlink" href="#appconf.AppConf.Meta.required" title="Permalink to this definition">¶</a></dt> <dd><p>A list of settings that must be defined. If any of the specified settings are not defined, <code class="docutils literal notranslate"><span class="pre">ImproperlyConfigured</span></code> will be raised.</p> <div class="versionadded"> <p><span class="versionmodified">New in version 0.6.</span></p> </div> </dd></dl> <dl class="attribute"> <dt id="appconf.AppConf.Meta.holder"> <code class="descname">holder</code><a class="headerlink" href="#appconf.AppConf.Meta.holder" title="Permalink to this definition">¶</a></dt> <dd><p>The global settings holder to use when looking for overrides and when setting the configured values.</p> <p>Defaults to <code class="docutils literal notranslate"><span class="pre">'django.conf.settings'</span></code>.</p> </dd></dl> <dl class="attribute"> <dt id="appconf.AppConf.Meta.proxy"> <code class="descname">proxy</code><a class="headerlink" href="#appconf.AppConf.Meta.proxy" title="Permalink to this definition">¶</a></dt> <dd><p>A boolean, if set to <code class="docutils literal notranslate"><span class="pre">True</span></code> will enable proxying attribute access to the <a class="reference internal" href="#appconf.AppConf.Meta.holder" title="appconf.AppConf.Meta.holder"><code class="xref py py-attr docutils literal notranslate"><span class="pre">holder</span></code></a>.</p> </dd></dl> </dd></dl> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="usage.html" title="previous chapter">Usage</a></p> <h4>Next topic</h4> <p class="topless"><a href="changelog.html" title="next chapter">Changelog</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/reference.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <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="usage.html" title="Usage" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">django-appconf 1.0.2 documentation</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2011-2013, Jannis Leidel and individual contributors. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.8.3. </div> </body> </html>