Deployed ccf02fa to dev with MkDocs 1.6.1 and mike 2.1.3

This commit is contained in:
github-actions 2025-05-11 13:00:41 +00:00
parent 7f8d53a0f5
commit de0b7dfc14
35 changed files with 159 additions and 167 deletions

View file

@ -58,7 +58,7 @@
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>autodiscover</span><span class=o>=</span><span class=kc>False</span><span class=p>,</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=p>)</span>
</code></pre></div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.cache class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">cache</span> <a href=#django_components.app_settings.ComponentsSettings.cache class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>cache</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L239 target=_blank>See source code</a></p> <p>Name of the <a href=https://docs.djangoproject.com/en/5.1/topics/cache/ >Django cache</a> to be used for storing component's JS and CSS files.</p> <p>If <code>None</code>, a <a href=https://docs.djangoproject.com/en/5.1/topics/cache/#local-memory-caching><code>LocMemCache</code></a> is used with default settings.</p> <p>Defaults to <code>None</code>.</p> <p>Read more about <a href=../../guides/setup/caching>caching</a>.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L239 target=_blank>See source code</a></p> <p>Name of the <a href=https://docs.djangoproject.com/en/5.2/topics/cache/ >Django cache</a> to be used for storing component's JS and CSS files.</p> <p>If <code>None</code>, a <a href=https://docs.djangoproject.com/en/5.2/topics/cache/#local-memory-caching><code>LocMemCache</code></a> is used with default settings.</p> <p>Defaults to <code>None</code>.</p> <p>Read more about <a href=../../guides/setup/caching>caching</a>.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>cache</span><span class=o>=</span><span class=s2>&quot;my_cache&quot;</span><span class=p>,</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=p>)</span>
</code></pre></div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.context_behavior class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">context_behavior</span> <a href=#django_components.app_settings.ComponentsSettings.context_behavior class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>context_behavior</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><span title=django_components.app_settings.ContextBehaviorType>ContextBehaviorType</span></span><span class=p>]</span> <span class=o>=</span> <span class=kc>None</span>
@ -74,7 +74,7 @@
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>debug_highlight_slots</span><span class=o>=</span><span class=kc>True</span><span class=p>,</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=p>)</span>
</code></pre></div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.dirs class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">dirs</span> <a href=#django_components.app_settings.ComponentsSettings.dirs class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>dirs</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.Sequence href=https://docs.python.org/3.12/library/typing.html#typing.Sequence>Sequence</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.Union href=https://docs.python.org/3.12/library/typing.html#typing.Union>Union</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" title=os.PathLike href=https://docs.python.org/3.12/library/os.html#os.PathLike>PathLike</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" title=typing.Tuple href=https://docs.python.org/3.12/library/typing.html#typing.Tuple>Tuple</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>],</span> <span class=n><a class="autorefs autorefs-external" title=typing.Tuple href=https://docs.python.org/3.12/library/typing.html#typing.Tuple>Tuple</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" title=os.PathLike href=https://docs.python.org/3.12/library/os.html#os.PathLike>PathLike</a></span><span class=p>]]]]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L184 target=_blank>See source code</a></p> <p>Specify the directories that contain your components.</p> <p>Defaults to <code>[Path(settings.BASE_DIR) / "components"]</code>. That is, the root <code>components/</code> app.</p> <p>Directories must be full paths, same as with <a href=https://docs.djangoproject.com/en/5.1/ref/settings/#std-setting-STATICFILES_DIRS>STATICFILES_DIRS</a>.</p> <p>These locations are searched during <a href=../../concepts/fundamentals/autodiscovery>autodiscovery</a>, or when you <a href=../../concepts/fundamentals/defining_js_css_html_files>define HTML, JS, or CSS as separate files</a>.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L184 target=_blank>See source code</a></p> <p>Specify the directories that contain your components.</p> <p>Defaults to <code>[Path(settings.BASE_DIR) / "components"]</code>. That is, the root <code>components/</code> app.</p> <p>Directories must be full paths, same as with <a href=https://docs.djangoproject.com/en/5.2/ref/settings/#std-setting-STATICFILES_DIRS>STATICFILES_DIRS</a>.</p> <p>These locations are searched during <a href=../../concepts/fundamentals/autodiscovery>autodiscovery</a>, or when you <a href=../../concepts/fundamentals/defining_js_css_html_files>define HTML, JS, or CSS as separate files</a>.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>dirs</span><span class=o>=</span><span class=p>[</span><span class=n>BASE_DIR</span> <span class=o>/</span> <span class=s2>&quot;components&quot;</span><span class=p>],</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=p>)</span>
</code></pre></div> <p>Set to empty list to disable global components directories:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
@ -106,7 +106,7 @@
<a id=__codelineno-0-5 name=__codelineno-0-5 href=#__codelineno-0-5></a> <span class=s2>&quot;mysite.components.cards&quot;</span><span class=p>,</span>
<a id=__codelineno-0-6 name=__codelineno-0-6 href=#__codelineno-0-6></a> <span class=p>],</span>
<a id=__codelineno-0-7 name=__codelineno-0-7 href=#__codelineno-0-7></a><span class=p>)</span>
</code></pre></div> <p>This would be the equivalent of importing these modules from within Django's <a href=https://docs.djangoproject.com/en/5.1/ref/applications/#django.apps.AppConfig.ready><code>AppConfig.ready()</code></a>:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a><span class=k>class</span><span class=w> </span><span class=nc>MyAppConfig</span><span class=p>(</span><span class=n>AppConfig</span><span class=p>):</span>
</code></pre></div> <p>This would be the equivalent of importing these modules from within Django's <a href=https://docs.djangoproject.com/en/5.2/ref/applications/#django.apps.AppConfig.ready><code>AppConfig.ready()</code></a>:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a><span class=k>class</span><span class=w> </span><span class=nc>MyAppConfig</span><span class=p>(</span><span class=n>AppConfig</span><span class=p>):</span>
<a id=__codelineno-1-2 name=__codelineno-1-2 href=#__codelineno-1-2></a> <span class=k>def</span><span class=w> </span><span class=nf>ready</span><span class=p>(</span><span class=bp>self</span><span class=p>):</span>
<a id=__codelineno-1-3 name=__codelineno-1-3 href=#__codelineno-1-3></a> <span class=kn>import</span><span class=w> </span><span class=s2>&quot;mysite.components.forms&quot;</span>
<a id=__codelineno-1-4 name=__codelineno-1-4 href=#__codelineno-1-4></a> <span class=kn>import</span><span class=w> </span><span class=s2>&quot;mysite.components.buttons&quot;</span>
@ -121,7 +121,7 @@
</code></pre></div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.reload_on_file_change class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">reload_on_file_change</span> <a href=#django_components.app_settings.ComponentsSettings.reload_on_file_change class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>reload_on_file_change</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/functions.html#bool>bool</a></span><span class=p>]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L408 target=_blank>See source code</a></p> <p>This is relevant if you are using the project structure where HTML, JS, CSS and Python are in separate files and nested in a directory.</p> <p>In this case you may notice that when you are running a development server, the server sometimes does not reload when you change component files.</p> <p>Django's native <a href=https://stackoverflow.com/a/66023029/9788634>live reload</a> logic handles only Python files and HTML template files. It does NOT reload when other file types change or when template files are nested more than one level deep.</p> <p>The setting <code>reload_on_file_change</code> fixes this, reloading the dev server even when your component's HTML, JS, or CSS changes.</p> <p>If <code>True</code>, django_components configures Django to reload when files inside <a href=../settings/#django_components.app_settings.ComponentsSettings.dirs><code>COMPONENTS.dirs</code></a> or <a href=../settings/#django_components.app_settings.ComponentsSettings.app_dirs><code>COMPONENTS.app_dirs</code></a> change.</p> <p>See <a href=../../guides/setup/development_server/#reload-dev-server-on-component-file-changes>Reload dev server on component file changes</a>.</p> <p>Defaults to <code>False</code>.</p> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>This setting should be enabled only for the dev environment!</p> </div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.reload_on_template_change class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">reload_on_template_change</span> <a href=#django_components.app_settings.ComponentsSettings.reload_on_template_change class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>reload_on_template_change</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/functions.html#bool>bool</a></span><span class=p>]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L403 target=_blank>See source code</a></p> <p>Deprecated. Use <a href=../settings/#django_components.app_settings.ComponentsSettings.reload_on_file_change><code>COMPONENTS.reload_on_file_change</code></a> instead.</p> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.static_files_allowed class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">static_files_allowed</span> <a href=#django_components.app_settings.ComponentsSettings.static_files_allowed class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>static_files_allowed</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.List href=https://docs.python.org/3.12/library/typing.html#typing.List>List</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.Union href=https://docs.python.org/3.12/library/typing.html#typing.Union>Union</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" title=re.Pattern href=https://docs.python.org/3.12/library/re.html#re.Pattern>Pattern</a></span><span class=p>]]]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L438 target=_blank>See source code</a></p> <p>A list of file extensions (including the leading dot) that define which files within <a href=../settings/#django_components.app_settings.ComponentsSettings.dirs><code>COMPONENTS.dirs</code></a> or <a href=../settings/#django_components.app_settings.ComponentsSettings.app_dirs><code>COMPONENTS.app_dirs</code></a> are treated as <a href=https://docs.djangoproject.com/en/5.1/howto/static-files/ >static files</a>.</p> <p>If a file is matched against any of the patterns, it's considered a static file. Such files are collected when running <a href=https://docs.djangoproject.com/en/5.1/ref/contrib/staticfiles/#collectstatic><code>collectstatic</code></a>, and can be accessed under the <a href=https://docs.djangoproject.com/en/5.1/ref/settings/#static-url>static file endpoint</a>.</p> <p>You can also pass in compiled regexes (<a href=https://docs.python.org/3/library/re.html#re.Pattern><code>re.Pattern</code></a>) for more advanced patterns.</p> <p>By default, JS, CSS, and common image and font file formats are considered static files:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L438 target=_blank>See source code</a></p> <p>A list of file extensions (including the leading dot) that define which files within <a href=../settings/#django_components.app_settings.ComponentsSettings.dirs><code>COMPONENTS.dirs</code></a> or <a href=../settings/#django_components.app_settings.ComponentsSettings.app_dirs><code>COMPONENTS.app_dirs</code></a> are treated as <a href=https://docs.djangoproject.com/en/5.2/howto/static-files/ >static files</a>.</p> <p>If a file is matched against any of the patterns, it's considered a static file. Such files are collected when running <a href=https://docs.djangoproject.com/en/5.2/ref/contrib/staticfiles/#collectstatic><code>collectstatic</code></a>, and can be accessed under the <a href=https://docs.djangoproject.com/en/5.2/ref/settings/#static-url>static file endpoint</a>.</p> <p>You can also pass in compiled regexes (<a href=https://docs.python.org/3/library/re.html#re.Pattern><code>re.Pattern</code></a>) for more advanced patterns.</p> <p>By default, JS, CSS, and common image and font file formats are considered static files:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>static_files_allowed</span><span class=o>=</span><span class=p>[</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a> <span class=s2>&quot;.css&quot;</span><span class=p>,</span>
<a id=__codelineno-0-4 name=__codelineno-0-4 href=#__codelineno-0-4></a> <span class=s2>&quot;.js&quot;</span><span class=p>,</span> <span class=s2>&quot;.jsx&quot;</span><span class=p>,</span> <span class=s2>&quot;.ts&quot;</span><span class=p>,</span> <span class=s2>&quot;.tsx&quot;</span><span class=p>,</span>
@ -134,7 +134,7 @@
<a id=__codelineno-0-11 name=__codelineno-0-11 href=#__codelineno-0-11></a> <span class=p>],</span>
<a id=__codelineno-0-12 name=__codelineno-0-12 href=#__codelineno-0-12></a><span class=p>)</span>
</code></pre></div> <div class="admonition warning"> <p class=admonition-title>Warning</p> <p>Exposing your Python files can be a security vulnerability. See <a href=../../overview/security_notes>Security notes</a>.</p> </div> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.static_files_forbidden class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">static_files_forbidden</span> <a href=#django_components.app_settings.ComponentsSettings.static_files_forbidden class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>static_files_forbidden</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.List href=https://docs.python.org/3.12/library/typing.html#typing.List>List</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" title=typing.Union href=https://docs.python.org/3.12/library/typing.html#typing.Union>Union</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/stdtypes.html#str>str</a></span><span class=p>,</span> <span class=n><a class="autorefs autorefs-external" title=re.Pattern href=https://docs.python.org/3.12/library/re.html#re.Pattern>Pattern</a></span><span class=p>]]]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L483 target=_blank>See source code</a></p> <p>A list of file extensions (including the leading dot) that define which files within <a href=../settings/#django_components.app_settings.ComponentsSettings.dirs><code>COMPONENTS.dirs</code></a> or <a href=../settings/#django_components.app_settings.ComponentsSettings.app_dirs><code>COMPONENTS.app_dirs</code></a> will NEVER be treated as <a href=https://docs.djangoproject.com/en/5.1/howto/static-files/ >static files</a>.</p> <p>If a file is matched against any of the patterns, it will never be considered a static file, even if the file matches a pattern in <a href=../settings/#django_components.app_settings.ComponentsSettings.static_files_allowed><code>static_files_allowed</code></a>.</p> <p>Use this setting together with <a href=../settings/#django_components.app_settings.ComponentsSettings.static_files_allowed><code>static_files_allowed</code></a> for a fine control over what file types will be exposed.</p> <p>You can also pass in compiled regexes (<a href=https://docs.python.org/3/library/re.html#re.Pattern><code>re.Pattern</code></a>) for more advanced patterns.</p> <p>By default, any HTML and Python are considered NOT static files:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L483 target=_blank>See source code</a></p> <p>A list of file extensions (including the leading dot) that define which files within <a href=../settings/#django_components.app_settings.ComponentsSettings.dirs><code>COMPONENTS.dirs</code></a> or <a href=../settings/#django_components.app_settings.ComponentsSettings.app_dirs><code>COMPONENTS.app_dirs</code></a> will NEVER be treated as <a href=https://docs.djangoproject.com/en/5.2/howto/static-files/ >static files</a>.</p> <p>If a file is matched against any of the patterns, it will never be considered a static file, even if the file matches a pattern in <a href=../settings/#django_components.app_settings.ComponentsSettings.static_files_allowed><code>static_files_allowed</code></a>.</p> <p>Use this setting together with <a href=../settings/#django_components.app_settings.ComponentsSettings.static_files_allowed><code>static_files_allowed</code></a> for a fine control over what file types will be exposed.</p> <p>You can also pass in compiled regexes (<a href=https://docs.python.org/3/library/re.html#re.Pattern><code>re.Pattern</code></a>) for more advanced patterns.</p> <p>By default, any HTML and Python are considered NOT static files:</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>static_files_forbidden</span><span class=o>=</span><span class=p>[</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a> <span class=s2>&quot;.html&quot;</span><span class=p>,</span> <span class=s2>&quot;.django&quot;</span><span class=p>,</span> <span class=s2>&quot;.dj&quot;</span><span class=p>,</span> <span class=s2>&quot;.tpl&quot;</span><span class=p>,</span>
<a id=__codelineno-0-4 name=__codelineno-0-4 href=#__codelineno-0-4></a> <span class=c1># Python files</span>
@ -163,7 +163,7 @@
<a id=__codelineno-5-2 name=__codelineno-5-2 href=#__codelineno-5-2></a><span class=x> Click me!</span>
<a id=__codelineno-5-3 name=__codelineno-5-3 href=#__codelineno-5-3></a><span class=cp>{%</span> <span class=k>endbutton</span> <span class=cp>%}</span>
</code></pre></div> </li> </ul> </div> </div> <div class="doc doc-object doc-attribute"> <h2 id=django_components.app_settings.ComponentsSettings.template_cache_size class="doc doc-heading"> <span class="doc doc-object-name doc-attribute-name">template_cache_size</span> <a href=#django_components.app_settings.ComponentsSettings.template_cache_size class=headerlink title="Permanent link">¤</a></h2> <div class="doc-signature highlight"><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>template_cache_size</span><span class=p>:</span> <span class=n><a class="autorefs autorefs-external" title=typing.Optional href=https://docs.python.org/3.12/library/typing.html#typing.Optional>Optional</a></span><span class=p>[</span><span class=n><a class="autorefs autorefs-external" href=https://docs.python.org/3.12/library/functions.html#int>int</a></span><span class=p>]</span> <span class=o>=</span> <span class=kc>None</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L586 target=_blank>See source code</a></p> <p>Configure the maximum amount of Django templates to be cached.</p> <p>Defaults to <code>128</code>.</p> <p>Each time a <a href=https://docs.djangoproject.com/en/5.1/ref/templates/api/#django.template.Template>Django template</a> is rendered, it is cached to a global in-memory cache (using Python's <a href=https://docs.python.org/3/library/functools.html#functools.lru_cache><code>lru_cache</code></a> decorator). This speeds up the next render of the component. As the same component is often used many times on the same page, these savings add up.</p> <p>By default the cache holds 128 component templates in memory, which should be enough for most sites. But if you have a lot of components, or if you are overriding <a href=../api#django_components.Component.get_template><code>Component.get_template()</code></a> to render many dynamic templates, you can increase this number.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
</code></pre></div> <div class="doc doc-contents first"> <p><a href=https://github.com/django-components/django-components/tree/master/src/django_components/app_settings.py#L586 target=_blank>See source code</a></p> <p>Configure the maximum amount of Django templates to be cached.</p> <p>Defaults to <code>128</code>.</p> <p>Each time a <a href=https://docs.djangoproject.com/en/5.2/ref/templates/api/#django.template.Template>Django template</a> is rendered, it is cached to a global in-memory cache (using Python's <a href=https://docs.python.org/3/library/functools.html#functools.lru_cache><code>lru_cache</code></a> decorator). This speeds up the next render of the component. As the same component is often used many times on the same page, these savings add up.</p> <p>By default the cache holds 128 component templates in memory, which should be enough for most sites. But if you have a lot of components, or if you are overriding <a href=../api#django_components.Component.get_template><code>Component.get_template()</code></a> to render many dynamic templates, you can increase this number.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-0-1 name=__codelineno-0-1 href=#__codelineno-0-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>
<a id=__codelineno-0-2 name=__codelineno-0-2 href=#__codelineno-0-2></a> <span class=n>template_cache_size</span><span class=o>=</span><span class=mi>256</span><span class=p>,</span>
<a id=__codelineno-0-3 name=__codelineno-0-3 href=#__codelineno-0-3></a><span class=p>)</span>
</code></pre></div> <p>To remove the cache limit altogether and cache everything, set <code>template_cache_size</code> to <code>None</code>.</p> <div class=highlight><pre><span></span><code><a id=__codelineno-1-1 name=__codelineno-1-1 href=#__codelineno-1-1></a><span class=n>COMPONENTS</span> <span class=o>=</span> <span class=n>ComponentsSettings</span><span class=p>(</span>