{"title":"URLconf で使用するための django.urls 関数","version":"6.0","locale":"ja","docname":"ref/urls","url":"/ja/6.0/ref/urls/","canonical":"https://djangodocs.dev/ja/6.0/ref/urls/","summary":"urlpatterns に含める要素を返します。","html":"<section id=\"module-django.urls.conf\">\n<span id=\"django-urls-functions-for-use-in-urlconfs\"></span><h1>URLconf で使用するための <code class=\"docutils literal notranslate\">django.urls</code> 関数<a class=\"heading-anchor\" href=\"#module-django.urls.conf\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"path\">\n<h2><code class=\"docutils literal notranslate\">path()</code><a class=\"heading-anchor\" href=\"#path\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"django.urls.path\">\n<span class=\"sig-name descname\">path</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">route</em>, <em class=\"sig-param\">view</em>, <em class=\"sig-param\">kwargs<span class=\"o\">=</span><span class=\"default_value\">None</span></em>, <em class=\"sig-param\">name<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.urls.path\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p><code class=\"docutils literal notranslate\">urlpatterns</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=\"nn\">django.urls</span> <span class=\"kn\">import</span> include<span class=\"p\">,</span> path\n\nurlpatterns <span class=\"o\">=</span> <span class=\"p\">[</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;index/&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>index<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;main-view&quot;</span><span class=\"p\">),</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;bio/&lt;username&gt;/&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>bio<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;bio&quot;</span><span class=\"p\">),</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;articles/&lt;slug:title&gt;/&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>article<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;article-detail&quot;</span><span class=\"p\">),</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;articles/&lt;slug:title&gt;/&lt;int:section&gt;/&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>section<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;article-section&quot;</span><span class=\"p\">),</span>\n    path<span class=\"p\">(</span><span class=\"s2\">&quot;blog/&quot;</span><span class=\"p\">,</span> include<span class=\"p\">(</span><span class=\"s2\">&quot;blog.urls&quot;</span><span class=\"p\">)),</span>\n    <span class=\"o\">...</span><span class=\"p\">,</span>\n<span class=\"p\">]</span>\n</code></pre></div>\n<section id=\"route\">\n<h3><code class=\"docutils literal notranslate\">route</code><a class=\"heading-anchor\" href=\"#route\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The <code class=\"docutils literal notranslate\">route</code> argument should be a string or\n<a class=\"reference internal\" href=\"/ja/6.0/ref/utils/#django.utils.translation.gettext_lazy\" title=\"django.utils.translation.gettext_lazy\"><code class=\"xref py py-func docutils literal notranslate\">gettext_lazy()</code></a> (see\n<a class=\"reference internal\" href=\"/ja/6.0/topics/i18n/translation/#translating-urlpatterns\"><span class=\"std std-ref\">URL パターンを翻訳する</span></a>) that contains a URL pattern. The string\nmay contain angle brackets (like <code class=\"docutils literal notranslate\">&lt;username&gt;</code> above) to capture part of the\nURL and send it as a keyword argument to the view. The angle brackets may\ninclude a converter specification (like the <code class=\"docutils literal notranslate\">int</code> part of <code class=\"docutils literal notranslate\">&lt;int:section&gt;</code>)\nwhich limits the characters matched and may also change the type of the\nvariable passed to the view. For example, <code class=\"docutils literal notranslate\">&lt;int:section&gt;</code> matches a string\nof decimal digits and converts the value to an <code class=\"docutils literal notranslate\">int</code>.</p>\n<p>リクエストを処理する際、Djangoは <code class=\"docutils literal notranslate\">urlpatterns</code> の最初のパターンから処理を開始し、リストを順番に進みながら、リクエストされたURLと各パターンを比較します。一致するパターンが見つかるまでこの比較を行い、最初に一致したパターンが処理されます。詳細については、<a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#how-django-processes-a-request\"><span class=\"std std-ref\">Django のリクエスト処理</span></a> を参照してください。</p>\n<p>URLパターンは、GETやPOSTのパラメータやドメイン名にはマッチしません。例えば、<code class=\"docutils literal notranslate\">https://www.example.com/myapp/</code> へのリクエストでは、URLconfは <code class=\"docutils literal notranslate\">myapp/</code> を探します。また、<code class=\"docutils literal notranslate\">https://www.example.com/myapp/?page=3</code> へのリクエストでも、URLconfは同様に <code class=\"docutils literal notranslate\">myapp/</code> を探します。</p>\n</section>\n<section id=\"view\">\n<h3><code class=\"docutils literal notranslate\">view</code><a class=\"heading-anchor\" href=\"#view\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">view</code> 引数は、ビュー関数、またはクラスベースビューの場合は <a class=\"reference internal\" href=\"/ja/6.0/ref/class-based-views/base/#django.views.generic.base.View.as_view\" title=\"django.views.generic.base.View.as_view\"><code class=\"xref py py-meth docutils literal notranslate\">as_view()</code></a> の結果です。また、<code class=\"docutils literal notranslate\">view</code> 引数には、<a class=\"reference internal\" href=\"#django.urls.include\" title=\"django.urls.include\"><code class=\"xref py py-func docutils literal notranslate\">django.urls.include()</code></a> を指定することもできます。</p>\n<p>Djangoが一致するパターンを見つけると、指定されたビュー関数を呼び出し、最初の引数として <a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpRequest\" title=\"django.http.HttpRequest\"><code class=\"xref py py-class docutils literal notranslate\">HttpRequest</code></a> オブジェクトを渡し、ルートから「キャプチャされた」値をキーワード引数として渡します。</p>\n</section>\n<section id=\"kwargs\">\n<h3><code class=\"docutils literal notranslate\">kwargs</code><a class=\"heading-anchor\" href=\"#kwargs\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p><code class=\"docutils literal notranslate\">kwargs</code> 引数を使用すると、ビュー関数またはメソッドに追加の引数を渡すことができます。例については、<a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#views-extra-options\"><span class=\"std std-ref\">追加的なオプションをビュー関数に渡す</span></a> を参照してください。</p>\n</section>\n<section id=\"name\">\n<h3><code class=\"docutils literal notranslate\">name</code><a class=\"heading-anchor\" href=\"#name\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>URL に名前付けをしておけば Django のどこからでも明確に参照でき、とくにテンプレートの中で有効です。この便利な機能のおかげで、プロジェクトのURLにグローバルな変更を加える場合にも1つのファイルを変更するだけで済むようになります。</p>\n<p><code class=\"docutils literal notranslate\">name</code> 引数が有用な理由については、<a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#naming-url-patterns\"><span class=\"std std-ref\">URL パターンの命名</span></a> を参照してください。</p>\n</section>\n</section>\n<section id=\"re-path\">\n<h2><code class=\"docutils literal notranslate\">re_path()</code><a class=\"heading-anchor\" href=\"#re-path\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"django.urls.re_path\">\n<span class=\"sig-name descname\">re_path</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">route</em>, <em class=\"sig-param\">view</em>, <em class=\"sig-param\">kwargs<span class=\"o\">=</span><span class=\"default_value\">None</span></em>, <em class=\"sig-param\">name<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.urls.re_path\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p><code class=\"docutils literal notranslate\">urlpatterns</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=\"nn\">django.urls</span> <span class=\"kn\">import</span> include<span class=\"p\">,</span> re_path\n\nurlpatterns <span class=\"o\">=</span> <span class=\"p\">[</span>\n    re_path<span class=\"p\">(</span><span class=\"sa\">r</span><span class=\"s2\">&quot;^index/$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>index<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;index&quot;</span><span class=\"p\">),</span>\n    re_path<span class=\"p\">(</span><span class=\"sa\">r</span><span class=\"s2\">&quot;^bio/(?P&lt;username&gt;\\w+)/$&quot;</span><span class=\"p\">,</span> views<span class=\"o\">.</span>bio<span class=\"p\">,</span> name<span class=\"o\">=</span><span class=\"s2\">&quot;bio&quot;</span><span class=\"p\">),</span>\n    re_path<span class=\"p\">(</span><span class=\"sa\">r</span><span class=\"s2\">&quot;^blog/&quot;</span><span class=\"p\">,</span> include<span class=\"p\">(</span><span class=\"s2\">&quot;blog.urls&quot;</span><span class=\"p\">)),</span>\n    <span class=\"o\">...</span><span class=\"p\">,</span>\n<span class=\"p\">]</span>\n</code></pre></div>\n<p>The <code class=\"docutils literal notranslate\">route</code> argument should be a string or\n<a class=\"reference internal\" href=\"/ja/6.0/ref/utils/#django.utils.translation.gettext_lazy\" title=\"django.utils.translation.gettext_lazy\"><code class=\"xref py py-func docutils literal notranslate\">gettext_lazy()</code></a> (see\n<a class=\"reference internal\" href=\"/ja/6.0/topics/i18n/translation/#translating-urlpatterns\"><span class=\"std std-ref\">URL パターンを翻訳する</span></a>) that contains a regular expression compatible\nwith Python's <a class=\"reference external\" href=\"https://docs.python.org/3/library/re.html#module-re\" title=\"(in Python v3.14)\"><code class=\"xref py py-mod docutils literal notranslate\">re</code></a> module. Strings typically use raw string syntax\n(<code class=\"docutils literal notranslate\">r''</code>) so that they can contain sequences like <code class=\"docutils literal notranslate\">\\d</code> without the need to\nescape the backslash with another backslash. When a match is made, captured\ngroups from the regular expression are passed to the view -- as named arguments\nif the groups are named, and as positional arguments otherwise. The values are\npassed as strings, without any type conversion.</p>\n<p>When a <code class=\"docutils literal notranslate\">route</code> ends with <code class=\"docutils literal notranslate\">$</code> the whole requested URL, matching against\n<a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpRequest.path_info\" title=\"django.http.HttpRequest.path_info\"><code class=\"xref py py-attr docutils literal notranslate\">path_info</code></a>, must match the regular expression\npattern (<a class=\"reference external\" href=\"https://docs.python.org/3/library/re.html#re.fullmatch\" title=\"(in Python v3.14)\"><code class=\"xref py py-func docutils literal notranslate\">re.fullmatch()</code></a> is used).</p>\n<p>The <code class=\"docutils literal notranslate\">view</code>, <code class=\"docutils literal notranslate\">kwargs</code> and <code class=\"docutils literal notranslate\">name</code> arguments are the same as for\n<a class=\"reference internal\" href=\"#django.urls.path\" title=\"django.urls.path\"><code class=\"xref py py-func docutils literal notranslate\">path()</code></a>.</p>\n</section>\n<section id=\"include\">\n<h2><code class=\"docutils literal notranslate\">include()</code><a class=\"heading-anchor\" href=\"#include\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"django.urls.include\">\n<span class=\"sig-name descname\">include</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">module</em>, <em class=\"sig-param\">namespace<span class=\"o\">=</span><span class=\"default_value\">None</span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.urls.include\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dt class=\"sig sig-object py\">\n<span class=\"sig-name descname\">include</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">pattern_list</em><span class=\"sig-paren\">)</span></dt>\n<dt class=\"sig sig-object py\">\n<span class=\"sig-name descname\">include</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">(pattern_list</em>, <em class=\"sig-param\">app_namespace)</em>, <em class=\"sig-param\">namespace=None</em><span class=\"sig-paren\">)</span></dt>\n<dd><p>この場所に &quot;含める&quot; べき他のURLconfモジュールへのフルPythonインポートパスを取る関数です。オプションで、エントリが含まれる <a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#term-application-namespace\"><span class=\"xref std std-term\">application namespace</span></a> と <a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#term-instance-namespace\"><span class=\"xref std std-term\">instance namespace</span></a> も指定できます。</p>\n<p>通常、アプリケーションの名前空間は、include されたモジュールによって指定されるべきです。アプリケーションの名前空間が設定されている場合、 <code class=\"docutils literal notranslate\">namespace</code> 引数を使用して異なるインスタンスの名前空間を設定できます。</p>\n<p><code class=\"docutils literal notranslate\">include()</code> は、URL パターンを返すイテレータ、またはそのようなイテレータに加えてアプリケーションの名前空間の名前を含む 2値タプルを引数として受け入れることもできます。</p>\n<dl class=\"field-list simple\">\n<dt class=\"field-odd\">パラメータ<span class=\"colon\">:</span></dt>\n<dd class=\"field-odd\"><ul class=\"simple\">\n<li><p><strong>module</strong> -- URLconf モジュール（またはモジュール名）</p></li>\n<li><p><strong>namespace</strong> (<a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#str\" title=\"(in Python v3.14)\"><em>str</em></a>) -- インクルードされる URL エントリのインスタンス名前空間</p></li>\n<li><p><strong>pattern_list</strong> -- <a class=\"reference internal\" href=\"#django.urls.path\" title=\"django.urls.path\"><code class=\"xref py py-func docutils literal notranslate\">path()</code></a> および/または <a class=\"reference internal\" href=\"#django.urls.re_path\" title=\"django.urls.re_path\"><code class=\"xref py py-func docutils literal notranslate\">re_path()</code></a> のインスタンスのイテラブル。</p></li>\n<li><p><strong>app_namespace</strong> (<a class=\"reference external\" href=\"https://docs.python.org/3/library/stdtypes.html#str\" title=\"(in Python v3.14)\"><em>str</em></a>) -- include される URL エントリのアプリケーション名前空間</p></li>\n</ul>\n</dd>\n</dl>\n</dd></dl>\n\n<p><a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#including-other-urlconfs\"><span class=\"std std-ref\">他の URLconfs をインクルードする</span></a> および <a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#namespaces-and-include\"><span class=\"std std-ref\">URLの名前空間とインクルードされた URLconfs</span></a> を参照してください。</p>\n</section>\n<section id=\"register-converter\">\n<h2><code class=\"docutils literal notranslate\">register_converter()</code><a class=\"heading-anchor\" href=\"#register-converter\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"django.urls.register_converter\">\n<span class=\"sig-name descname\">register_converter</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">converter</em>, <em class=\"sig-param\">type_name</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.urls.register_converter\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>The function for registering a converter for use in <a class=\"reference internal\" href=\"#django.urls.path\" title=\"django.urls.path\"><code class=\"xref py py-func docutils literal notranslate\">path()</code></a>\n<code class=\"docutils literal notranslate\">route</code>s.</p>\n<p><code class=\"docutils literal notranslate\">converter</code> 引数はコンバータークラスであり、 <code class=\"docutils literal notranslate\">type_name</code> はパスパターンで使用するコンバーター名です。例については <a class=\"reference internal\" href=\"/ja/6.0/topics/http/urls/#registering-custom-path-converters\"><span class=\"std std-ref\">独自のパスコンバータを登録する</span></a> を参照してください。</p>\n</section>\n</section>\n<section id=\"module-django.conf.urls\">\n<span id=\"django-conf-urls-functions-for-use-in-urlconfs\"></span><h1>URLconf で使用するための <code class=\"docutils literal notranslate\">django.conf.urls</code> の関数<a class=\"heading-anchor\" href=\"#module-django.conf.urls\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<section id=\"static\">\n<h2><code class=\"docutils literal notranslate\">static()</code><a class=\"heading-anchor\" href=\"#static\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py function\">\n<dt class=\"sig sig-object py\" id=\"django.conf.urls.static.static\">\n<span class=\"sig-prename descclassname\">static.</span><span class=\"sig-name descname\">static</span><span class=\"sig-paren\">(</span><em class=\"sig-param\">prefix</em>, <em class=\"sig-param\">view<span class=\"o\">=</span><span class=\"default_value\">django.views.static.serve</span></em>, <em class=\"sig-param\"><span class=\"o\">**</span>kwargs</em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.conf.urls.static.static\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>デバッグモードでファイルを配信するための URL パターンを返すヘルパー関数です:</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=\"nn\">django.conf</span> <span class=\"kn\">import</span> settings\n<span class=\"kn\">from</span> <span class=\"nn\">django.conf.urls.static</span> <span class=\"kn\">import</span> static\n\nurlpatterns <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> static<span class=\"p\">(</span>settings<span class=\"o\">.</span>MEDIA_URL<span class=\"p\">,</span> document_root<span class=\"o\">=</span>settings<span class=\"o\">.</span>MEDIA_ROOT<span class=\"p\">)</span>\n</code></pre></div>\n</section>\n<section id=\"handler400\">\n<h2><code class=\"docutils literal notranslate\">handler400</code><a class=\"heading-anchor\" href=\"#handler400\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py data\">\n<dt class=\"sig sig-object py\" id=\"django.conf.urls.handler400\">\n<span class=\"sig-name descname\">handler400</span><a class=\"heading-anchor\" href=\"#django.conf.urls.handler400\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>呼び出し可能オブジェクト、またはエラー状態を引き起こし、ステータスコードが400のレスポンスを送信した場合に呼び出されるべきビューへの完全なPythonインポートパスを表す文字列です。 HTTPクライアントがリクエストを送信した場合に該当します。</p>\n<p>デフォルトでは、これは <a class=\"reference internal\" href=\"/ja/6.0/ref/views/#django.views.defaults.bad_request\" title=\"django.views.defaults.bad_request\"><code class=\"xref py py-func docutils literal notranslate\">django.views.defaults.bad_request()</code></a> です。カスタムビューを実装する場合は、<code class=\"docutils literal notranslate\">request</code> および <code class=\"docutils literal notranslate\">exception</code> 引数を受け入れ、 <a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpResponseBadRequest\" title=\"django.http.HttpResponseBadRequest\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponseBadRequest</code></a> を返すことを確認してください。</p>\n</section>\n<section id=\"handler403\">\n<h2><code class=\"docutils literal notranslate\">handler403</code><a class=\"heading-anchor\" href=\"#handler403\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py data\">\n<dt class=\"sig sig-object py\" id=\"django.conf.urls.handler403\">\n<span class=\"sig-name descname\">handler403</span><a class=\"heading-anchor\" href=\"#django.conf.urls.handler403\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>呼び出し可能オブジェクト、またはユーザーがリソースへのアクセスに必要な権限を持っていない場合に呼び出されるべきビューの完全な Python インポートパスを表す文字列。</p>\n<p>デフォルトでは、これは <a class=\"reference internal\" href=\"/ja/6.0/ref/views/#django.views.defaults.permission_denied\" title=\"django.views.defaults.permission_denied\"><code class=\"xref py py-func docutils literal notranslate\">django.views.defaults.permission_denied()</code></a> です。カスタムビューを実装する場合には、<code class=\"docutils literal notranslate\">request</code> と <code class=\"docutils literal notranslate\">exception</code> 引数を受け入れ、 <a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpResponseForbidden\" title=\"django.http.HttpResponseForbidden\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponseForbidden</code></a> を返すことを確認してください。</p>\n</section>\n<section id=\"handler404\">\n<h2><code class=\"docutils literal notranslate\">handler404</code><a class=\"heading-anchor\" href=\"#handler404\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py data\">\n<dt class=\"sig sig-object py\" id=\"django.conf.urls.handler404\">\n<span class=\"sig-name descname\">handler404</span><a class=\"heading-anchor\" href=\"#django.conf.urls.handler404\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>呼び出し可能オブジェクト、もしくは、URL パターンに一致するものがない場合に呼び出されるべきビューへの完全な Python インポートパスを表す文字列。</p>\n<p>デフォルトでは、これは <a class=\"reference internal\" href=\"/ja/6.0/ref/views/#django.views.defaults.page_not_found\" title=\"django.views.defaults.page_not_found\"><code class=\"xref py py-func docutils literal notranslate\">django.views.defaults.page_not_found()</code></a> です。カスタムビューを実装する場合は、<code class=\"docutils literal notranslate\">request</code> と <code class=\"docutils literal notranslate\">exception</code> 引数を受け取り、<a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpResponseNotFound\" title=\"django.http.HttpResponseNotFound\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponseNotFound</code></a> を返すようにしてください。</p>\n</section>\n<section id=\"handler500\">\n<h2><code class=\"docutils literal notranslate\">handler500</code><a class=\"heading-anchor\" href=\"#handler500\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py data\">\n<dt class=\"sig sig-object py\" id=\"django.conf.urls.handler500\">\n<span class=\"sig-name descname\">handler500</span><a class=\"heading-anchor\" href=\"#django.conf.urls.handler500\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>呼び出し可能オブジェクト、もしくはサーバーエラーが発生した場合に呼び出されるべきビューを完全なPythonインポートパスで表した文字列です。サーバーエラーは、ビューコード内で実行時エラーが発生した時に起こります。</p>\n<p>デフォルトでは、これは <a class=\"reference internal\" href=\"/ja/6.0/ref/views/#django.views.defaults.server_error\" title=\"django.views.defaults.server_error\"><code class=\"xref py py-func docutils literal notranslate\">django.views.defaults.server_error()</code></a> です。独自のビューを実装する場合は、<code class=\"docutils literal notranslate\">request</code> 引数を受け取り、 <a class=\"reference internal\" href=\"/ja/6.0/ref/request-response/#django.http.HttpResponseServerError\" title=\"django.http.HttpResponseServerError\"><code class=\"xref py py-class docutils literal notranslate\">HttpResponseServerError</code></a> を返すことを確認してください。</p>\n</section>\n</section>\n","rootId":"","toc":[{"title":"URLconf で使用するための django.urls 関数","anchor":"","children":[{"title":"path()","anchor":"path","children":[{"title":"route","anchor":"route","children":[]},{"title":"view","anchor":"view","children":[]},{"title":"kwargs","anchor":"kwargs","children":[]},{"title":"name","anchor":"name","children":[]}]},{"title":"re_path()","anchor":"re-path","children":[]},{"title":"include()","anchor":"include","children":[]},{"title":"register_converter()","anchor":"register-converter","children":[]}]},{"title":"URLconf で使用するための django.conf.urls の関数","anchor":"module-django.conf.urls","children":[{"title":"static()","anchor":"static","children":[]},{"title":"handler400","anchor":"handler400","children":[]},{"title":"handler403","anchor":"handler403","children":[]},{"title":"handler404","anchor":"handler404","children":[]},{"title":"handler500","anchor":"handler500","children":[]}]}],"breadcrumbs":[{"docname":"ref/index","title":"API リファレンス","url":"/ja/6.0/ref/"}],"prev":{"docname":"ref/urlresolvers","title":"django.urls ユーティリティ関数","url":"/ja/6.0/ref/urlresolvers/"},"next":{"docname":"ref/utils","title":"Django ユーティリティ (django.utils)","url":"/ja/6.0/ref/utils/"},"formats":{"html":"/ja/6.0/ref/urls/","markdown":"/ja/6.0/ref/urls.md","json":"/ja/6.0/ref/urls.json"},"source":"https://github.com/django/django/blob/stable/6.0.x/docs/ref/urls.txt","official":"https://docs.djangoproject.com/ja/6.0/ref/urls/","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","sv","zh-hans","ga","fr","ja","id","it","pt-br","ko","es","el","pl"]}