{"title":"How to manage static files (e.g. images, JavaScript, CSS)","version":"4.1","locale":"ja","docname":"howto/static-files/index","url":"/ja/4.1/howto/static-files/","canonical":"https://djangodocs.dev/ja/4.1/howto/static-files/","summary":"ウェブサイトではふつう、画像や JavaScript、CSS などの追加のファイルを配信する必要があります。Django では、こうしたファイルのことを「静的ファイル (static files)」と呼んでいます。静的ファイルの管理を簡単にするために、Django は django.contrib.staticfiles…","html":"<h1>How to manage static files (e.g. images, JavaScript, CSS)<a class=\"heading-anchor\" href=\"#how-to-manage-static-files-e-g-images-javascript-css\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<p>ウェブサイトではふつう、画像や JavaScript、CSS などの追加のファイルを配信する必要があります。Django では、こうしたファイルのことを「静的ファイル (static files)」と呼んでいます。静的ファイルの管理を簡単にするために、Django は <a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> を提供しています。</p>\n<p>このページでは、こうした静的ファイルの配信の仕方について説明します。</p>\n<section id=\"configuring-static-files\">\n<h2>静的ファイルの設定<a class=\"heading-anchor\" href=\"#configuring-static-files\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<ol class=\"arabic\">\n<li><p><code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code> が設定ファイルの <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-INSTALLED_APPS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">INSTALLED_APPS</span></code></a> に含まれていることを確認してください。</p></li>\n<li><p>設定ファイルの中で、<a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_URL</span></code></a> を設定します。たとえば、次のようになります。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">STATIC_URL</span> <span class=\"o\">=</span> <span class=\"s1\">&#39;static/&#39;</span>\n</code></pre></div>\n</li>\n<li><p>テンプレート中では、<a class=\"reference internal\" href=\"/ja/4.1/ref/templates/builtins/#std-templatetag-static\"><code class=\"xref std std-ttag docutils literal notranslate\"><span class=\"pre\">static</span></code></a> テンプレートタグを使うことで、設定済みの <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATICFILES_STORAGE\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATICFILES_STORAGE</span></code></a> を含むある相対パスの URL を生成することができます。</p>\n<div class=\"code-block\" data-language=\"html+django\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Django template</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Django template code\"><code><span class=\"cp\">{%</span> <span class=\"k\">load</span> <span class=\"nv\">static</span> <span class=\"cp\">%}</span>\n<span class=\"p\">&lt;</span><span class=\"nt\">img</span> <span class=\"na\">src</span><span class=\"o\">=</span><span class=\"s\">&quot;</span><span class=\"cp\">{%</span> <span class=\"k\">static</span> <span class=\"s1\">&#39;my_app/example.jpg&#39;</span> <span class=\"cp\">%}</span><span class=\"s\">&quot;</span> <span class=\"na\">alt</span><span class=\"o\">=</span><span class=\"s\">&quot;My image&quot;</span><span class=\"p\">&gt;</span>\n</code></pre></div>\n</li>\n<li><p>アプリケーション内に <code class=\"docutils literal notranslate\"><span class=\"pre\">static</span></code> というフォルダを作って静的ファイルを保存してください。例えば、<code class=\"docutils literal notranslate\"><span class=\"pre\">my_app/static/my_app/example.jpg</span></code> となります。</p></li>\n</ol>\n<aside class=\"admonition-serving-the-files admonition\">\n<p class=\"admonition-title\">ファイルを配信する</p>\n<p>これらの設定の手順に加えて、実際に静的ファイルを配信する必要があります。</p>\n<p>開発中に <a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> を使用する場合には、<a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> を <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code> に設定して <a class=\"reference internal\" href=\"/ja/4.1/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">runserver</span></code></a> を実行すれば、自動的に設定が行われます。(詳しくは、<a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#django.contrib.staticfiles.views.serve\" title=\"django.contrib.staticfiles.views.serve\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles.views.serve()</span></code></a> を参照)</p>\n<p>ただし、この方法は <strong>極めて非効率</strong> であり、<strong>セキュリティ上の問題がある</strong> 可能性が高いため、<strong>本番環境で使うべきではありません</strong>。</p>\n<p>本番環境で静的ファイルを配信するための適切な戦略については、<a class=\"reference internal\" href=\"/ja/4.1/howto/static-files/deployment/\"><span class=\"doc\">How to deploy static files</span></a> を読んでください。</p>\n</aside>\n<p>プロジェクトには、特定のアプリケーションに紐付けられていない 静的な assets があることがあります。その場合には、アプリケーション内の <code class=\"docutils literal notranslate\"><span class=\"pre\">static/</span></code> ディレクトリの他に、設定ファイルでディレクトリのリスト (<a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATICFILES_DIRS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATICFILES_DIRS</span></code></a>) を定義して、Django が静的ファイルを検索できるようにすることができます。たとえば、次のように設定します。</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">STATICFILES_DIRS</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n    <span class=\"n\">BASE_DIR</span> <span class=\"o\">/</span> <span class=\"s2\">&quot;static&quot;</span><span class=\"p\">,</span>\n    <span class=\"s1\">&#39;/var/www/static/&#39;</span><span class=\"p\">,</span>\n<span class=\"p\">]</span>\n</code></pre></div>\n<p><code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code> がファイルを探索する方法について詳しくは、 <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATICFILES_FINDERS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATICFILES_FINDERS</span></code></a> のドキュメントを参照してください。</p>\n<aside class=\"admonition-static-file-namespacing admonition\">\n<p class=\"admonition-title\">静的ファイルの名前空間</p>\n<p>Now we <em>might</em> be able to get away with putting our static files directly\nin <code class=\"docutils literal notranslate\"><span class=\"pre\">my_app/static/</span></code> (rather than creating another <code class=\"docutils literal notranslate\"><span class=\"pre\">my_app</span></code>\nsubdirectory), but it would actually be a bad idea. Django will use the\nfirst static file it finds whose name matches, and if you had a static file\nwith the same name in a <em>different</em> application, Django would be unable to\ndistinguish between them. We need to be able to point Django at the right\none, and the best way to ensure this is by <em>namespacing</em> them. That is,\nby putting those static files inside <em>another</em> directory named for the\napplication itself.</p>\n<p>You can namespace static assets in <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATICFILES_DIRS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATICFILES_DIRS</span></code></a> by\nspecifying <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#staticfiles-dirs-prefixes\"><span class=\"std std-ref\">prefixes</span></a>.</p>\n</aside>\n</section>\n<section id=\"serving-static-files-during-development\">\n<span id=\"serving-static-files-in-development\"></span><h2>開発時の静的ファイルの取扱い<a class=\"heading-anchor\" href=\"#serving-static-files-during-development\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>上で述べたたように <a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> を利用する場合、 <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-DEBUG\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">DEBUG</span></code></a> が <code class=\"docutils literal notranslate\"><span class=\"pre\">True</span></code> であれば <a class=\"reference internal\" href=\"/ja/4.1/ref/django-admin/#django-admin-runserver\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">runserver</span></code></a> は自動的にこの処理を行います。もし <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-INSTALLED_APPS\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">INSTALLED_APPS</span></code></a> 内に <code class=\"docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code> が存在しない場合は、手動で <a class=\"reference internal\" href=\"/ja/4.1/ref/views/#django.views.static.serve\" title=\"django.views.static.serve\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">django.views.static.serve()</span></code></a> ビューを用いて静的ファイルを取り扱わなければなりません。</p>\n<p>この機能は本番環境で利用するのに適していません! 一般的なデプロイ方法に関しては <a class=\"reference internal\" href=\"/ja/4.1/howto/static-files/deployment/\"><span class=\"doc\">How to deploy static files</span></a> を参照ください。</p>\n<p>For example, if your <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_URL\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_URL</span></code></a> is defined as <code class=\"docutils literal notranslate\"><span class=\"pre\">static/</span></code>, you can\ndo this by adding the following snippet to your <code class=\"docutils literal notranslate\"><span class=\"pre\">urls.py</span></code>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.conf</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">settings</span>\n<span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.conf.urls.static</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">static</span>\n\n<span class=\"n\">urlpatterns</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n    <span class=\"c1\"># ... the rest of your URLconf goes here ...</span>\n<span class=\"p\">]</span> <span class=\"o\">+</span> <span class=\"n\">static</span><span class=\"p\">(</span><span class=\"n\">settings</span><span class=\"o\">.</span><span class=\"n\">STATIC_URL</span><span class=\"p\">,</span> <span class=\"n\">document_root</span><span class=\"o\">=</span><span class=\"n\">settings</span><span class=\"o\">.</span><span class=\"n\">STATIC_ROOT</span><span class=\"p\">)</span>\n</code></pre></div>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">注釈</p>\n<p>This helper function works only in debug mode and only if\nthe given prefix is local (e.g. <code class=\"docutils literal notranslate\"><span class=\"pre\">static/</span></code>) and not a URL (e.g.\n<code class=\"docutils literal notranslate\"><span class=\"pre\">http://static.example.com/</span></code>).</p>\n<p>またこのヘルパー関数は <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_ROOT</span></code></a> のフォルダのみを利用します; <a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> のように静的ファイルの探索は行いません。</p>\n<p>Finally, static files are served via a wrapper at the WSGI application\nlayer. As a consequence, static files requests do not pass through the\nnormal <a class=\"reference internal\" href=\"/ja/4.1/topics/http/middleware/\"><span class=\"doc\">middleware chain</span></a>.</p>\n</aside>\n</section>\n<section id=\"serving-files-uploaded-by-a-user-during-development\">\n<span id=\"serving-uploaded-files-in-development\"></span><h2>ユーザーによりアップロードされるファイルの開発時の取扱い<a class=\"heading-anchor\" href=\"#serving-files-uploaded-by-a-user-during-development\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>開発中は、ユーザーによってアップロードされたメディアファイルを <a class=\"reference internal\" href=\"/ja/4.1/ref/views/#django.views.static.serve\" title=\"django.views.static.serve\"><code class=\"xref py py-func docutils literal notranslate\"><span class=\"pre\">django.views.static.serve()</span></code></a> ビューを利用している <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-MEDIA_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">MEDIA_ROOT</span></code></a> から利用できます。</p>\n<p>この機能は本番環境で利用するのに適していません! 一般的なデプロイ方法に関しては <a class=\"reference internal\" href=\"/ja/4.1/howto/static-files/deployment/\"><span class=\"doc\">How to deploy static files</span></a> を参照ください。</p>\n<p>For example, if your <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-MEDIA_URL\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">MEDIA_URL</span></code></a> is defined as <code class=\"docutils literal notranslate\"><span class=\"pre\">media/</span></code>, you can do\nthis by adding the following snippet to your <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-ROOT_URLCONF\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">ROOT_URLCONF</span></code></a>:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.conf</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">settings</span>\n<span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.conf.urls.static</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">static</span>\n\n<span class=\"n\">urlpatterns</span> <span class=\"o\">=</span> <span class=\"p\">[</span>\n    <span class=\"c1\"># ... the rest of your URLconf goes here ...</span>\n<span class=\"p\">]</span> <span class=\"o\">+</span> <span class=\"n\">static</span><span class=\"p\">(</span><span class=\"n\">settings</span><span class=\"o\">.</span><span class=\"n\">MEDIA_URL</span><span class=\"p\">,</span> <span class=\"n\">document_root</span><span class=\"o\">=</span><span class=\"n\">settings</span><span class=\"o\">.</span><span class=\"n\">MEDIA_ROOT</span><span class=\"p\">)</span>\n</code></pre></div>\n<aside class=\"admonition admonition-note\" role=\"note\">\n<p class=\"admonition-title\">注釈</p>\n<p>This helper function works only in debug mode and only if\nthe given prefix is local (e.g. <code class=\"docutils literal notranslate\"><span class=\"pre\">media/</span></code>) and not a URL (e.g.\n<code class=\"docutils literal notranslate\"><span class=\"pre\">http://media.example.com/</span></code>).</p>\n</aside>\n</section>\n<section id=\"testing\">\n<span id=\"staticfiles-testing-support\"></span><h2>テスト<a class=\"heading-anchor\" href=\"#testing\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>ビルトインのテストクライアント (たとえば、ビルトインの <a class=\"reference internal\" href=\"/ja/4.1/topics/testing/tools/#django.test.LiveServerTestCase\" title=\"django.test.LiveServerTestCase\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">LiveServerTestCase</span></code></a>) ではなく実際の HTTP リクエストを使用してテストを実行している場合、テスト環境が現実の環境をできるだけ忠実に再現できるように、他のコンテンツと同じように静的アセットも配信する必要があります。しかし、<code class=\"docutils literal notranslate\"><span class=\"pre\">LiveServerTestCase</span></code> はとても基本的な静的ファイル配信機能しかないため、<code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code> アプリケーションの探索機能はなく、すでに静的コンテンツは <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_ROOT</span></code></a> に集められていることを前提にしています。</p>\n<p>Because of this, <code class=\"docutils literal notranslate\"><span class=\"pre\">staticfiles</span></code> ships its own\n<a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#django.contrib.staticfiles.testing.StaticLiveServerTestCase\" title=\"django.contrib.staticfiles.testing.StaticLiveServerTestCase\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles.testing.StaticLiveServerTestCase</span></code></a>, a subclass\nof the built-in one that has the ability to transparently serve all the assets\nduring execution of these tests in a way very similar to what we get at\ndevelopment time with <code class=\"docutils literal notranslate\"><span class=\"pre\">DEBUG</span> <span class=\"pre\">=</span> <span class=\"pre\">True</span></code>, i.e. without having to collect them\nusing <a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> first.</p>\n</section>\n<section id=\"deployment\">\n<h2>デプロイ<a class=\"heading-anchor\" href=\"#deployment\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p><a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> には、静的ファイルを単一のディレクトリに集約するための便利な管理コマンドがあるので、静的ファイルを簡単に配信することができます。</p>\n<ol class=\"arabic\">\n<li><p><a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_ROOT</span></code></a> 設定で、どのディレクトリから静的ファイルを配信するかを指定します。たとえば:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"n\">STATIC_ROOT</span> <span class=\"o\">=</span> <span class=\"s2\">&quot;/var/www/example.com/static/&quot;</span>\n</code></pre></div>\n</li>\n<li><p><a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#django-admin-collectstatic\"><code class=\"xref std std-djadmin docutils literal notranslate\"><span class=\"pre\">collectstatic</span></code></a> 管理コマンドを実行します:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code>$ python manage.py collectstatic\n</code></pre></div>\n<p>これにより、各 static フォルダから <a class=\"reference internal\" href=\"/ja/4.1/ref/settings/#std-setting-STATIC_ROOT\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">STATIC_ROOT</span></code></a> のディレクトリにファイルがコピーされます。</p>\n</li>\n<li><p>あなた自身の選択で、ファイルを配信するウェブサーバーを使用してください。<a class=\"reference internal\" href=\"/ja/4.1/howto/static-files/deployment/\"><span class=\"doc\">How to deploy static files</span></a> で、静的ファイルに対する一般的なデプロイの戦略を紹介しています。</p></li>\n</ol>\n</section>\n<section id=\"learn-more\">\n<h2>さらに学ぶ<a class=\"heading-anchor\" href=\"#learn-more\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>このドキュメントでは、基本および一般的な利用パターンを紹介しました。<a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/#module-django.contrib.staticfiles\" title=\"django.contrib.staticfiles: An app for handling static files.\"><code class=\"xref py py-mod docutils literal notranslate\"><span class=\"pre\">django.contrib.staticfiles</span></code></a> に含まれるすべての設定、コマンド、テンプレートタグ、およびその他の事項に関する網羅的な詳細は、<a class=\"reference internal\" href=\"/ja/4.1/ref/contrib/staticfiles/\"><span class=\"doc\">the staticfiles reference</span></a> を参照してください。</p>\n</section>","rootId":"how-to-manage-static-files-e-g-images-javascript-css","toc":[{"title":"静的ファイルの設定","anchor":"configuring-static-files","children":[]},{"title":"開発時の静的ファイルの取扱い","anchor":"serving-static-files-during-development","children":[]},{"title":"ユーザーによりアップロードされるファイルの開発時の取扱い","anchor":"serving-files-uploaded-by-a-user-during-development","children":[]},{"title":"テスト","anchor":"testing","children":[]},{"title":"デプロイ","anchor":"deployment","children":[]},{"title":"さらに学ぶ","anchor":"learn-more","children":[]}],"breadcrumbs":[{"docname":"howto/index","title":"「How-to」ガイド","url":"/ja/4.1/howto/"}],"prev":{"docname":"howto/overriding-templates","title":"How to override templates","url":"/ja/4.1/howto/overriding-templates/"},"next":{"docname":"howto/static-files/deployment","title":"How to deploy static files","url":"/ja/4.1/howto/static-files/deployment/"},"formats":{"html":"/ja/4.1/howto/static-files/","markdown":"/ja/4.1/howto/static-files.md","json":"/ja/4.1/howto/static-files.json"},"source":"https://github.com/django/django/blob/stable/4.1.x/docs/howto/static-files/index.txt","official":"https://docs.djangoproject.com/ja/4.1/howto/static-files/","inVersions":["6.1","6.0","5.2","5.1","5.0","4.2","4.1","4.0","3.2","3.1","3.0","2.2","2.1","2.0","1.11","1.10","1.9"],"inLocales":["en","zh-hans","fr","ja","id","it","pt-br","ko","es","el","pl"]}