{"id":512,"date":"2021-04-29T01:29:42","date_gmt":"2021-04-28T16:29:42","guid":{"rendered":"http:\/\/www.agile-software.site\/?p=512"},"modified":"2021-07-11T17:46:54","modified_gmt":"2021-07-11T08:46:54","slug":"512","status":"publish","type":"post","link":"https:\/\/agile-software.net\/?p=512","title":{"rendered":"Django redirect"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">redirect<\/h2>\n\n\n\n<div class=\"wp-block-jin-gb-block-box-with-headline kaisetsu-box5\"><div class=\"kaisetsu-box5-title\">\u30ea\u30c0\u30a4\u30ec\u30af\u30c8<\/div>\n<p>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8\u3068\u306fWeb\u30da\u30fc\u30b8\u306b\u8a2a\u308c\u305f\u30e6\u30fc\u30b6\u30fc\u3092\u5225\u306eURL\u306b\u81ea\u52d5\u7684\u306b\u8a98\u5c0e\u30fb\u8ee2\u9001\u3059\u308b\u3053\u3068<\/p>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading\">.include<\/h2>\n\n\n\n<p>nclude\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4ed6\u306eurl.conf\u30d5\u30a1\u30a4\u30eb\u306b\u51e6\u7406\u3092\u4efb\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u4f8b\u3048\u3070<code>example.com\/contents\/0001.html<\/code>\u306e\u3088\u3046\u306aURL\u304c\u3042\u3063\u305f\u3068\u304d\u3001\u6700\u521d\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u307e\u3067\u306f\u3053\u3061\u3089\u306eurl.conf\u3067\u3001\u305d\u308c\u4ee5\u964d\u306e***.html\u306e\u90e8\u5206\u306f<code>contents\/<\/code>\u7528\u306eurl.conf\u3067\u5224\u5b9a\u3059\u308b\u3001\u3068\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001url.conf\u306e\u8a18\u8ff0\u304c\u7c21\u6f54\u306b\u306a\u308a\u3001\u307e\u305f\u958b\u767a\u74b0\u5883\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u3067\u304d\u307e\u3059<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">views.py<\/h2>\n\n\n\n<p>\u3053\u306e\u95a2\u6570\u306frequest, \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d1\u30b9\u3092\u6e21\u3059\u3068\u305d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u4f7f\u7528\u3057\u305f\u30ec\u30f3\u30c0\u30ea\u30f3\u30b0\u7d50\u679c\u3092<br>HttpResponse\u3068\u3057\u3066\u8fd4\u3057\u3066\u304f\u308c\u307e\u3059\uff0e<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\" data-file=\"accounts\/views.py\"><code>from django.shortcuts import render, redirect\nfrom django.views import View\n\n# Create your views here.\nclass ProfileView(View):\n    def get(self, request, *args, **kwargs):\n        return render(request, &#39;accounts\/profile.html&#39;)<\/code><\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">HttpResponse<\/h2>\n\n\n\n<p>Django\u304c\u3084\u3063\u3066\u3044\u308b\u3053\u3068\u306f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u3066\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u8fd4\u3057\u3066\u3044\u308b<\/p>\n\n\n\n<p>Django\u306furls.py\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u5fdc\u3057\u305fviews.py\u30d5\u30a1\u30a4\u30eb\u306e\u4e2d\u306eview\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\uff08\u3053\u306e\u6642\u3001\u5f15\u6570\u3068\u3057\u3066HttpReauest\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f7f\u308f\u308c\u307e\u3059\uff09\u3002view\u306e\u4e2d\u3067\u9069\u5207\u306a\u51e6\u7406\u304c\u5b9f\u884c\u3055\u308c\u305f\u5f8c\u3001view\u306fHttpResponse\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30b5\u30fc\u30d0\u30fc\u306b\u8fd4\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3042\u308b\u30da\u30fc\u30b8\u3078\u306e\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u53d6\u308b\u3068\u3001Django \u306f\u00a0<a href=\"https:\/\/django-docs-ja.readthedocs.io\/en\/1.0-maint\/ref\/request-response.html#django.http.HttpRequest\">HttpRequest<\/a>\u00a0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u751f\u6210\u3057\u307e\u3059\u3002\u3053\u306e\u30aa\u30d6\u30b8\u30a7\u30af \u30c8\u306b\u306f\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u304c\u5165\u3063\u3066\u3044\u307e\u3059\u3002<br>\u6b21\u306b Django \u306f\u9069\u5207\u306a\u30d3\u30e5\u30fc\u3092\u30ed\u30fc\u30c9\u3057\u3066\u3001\u00a0<a href=\"https:\/\/django-docs-ja.readthedocs.io\/en\/1.0-maint\/ref\/request-response.html#django.http.HttpRequest\">HttpRequest<\/a>\u00a0\u3092\u30d3\u30e5\u30fc\u95a2\u6570\u306e\u6700\u521d\u306e\u5f15\u6570\u306b\u6e21\u3057\u307e \u3059\u3002\u5404\u30d3\u30e5\u30fc\u306f\u00a0<a href=\"https:\/\/django-docs-ja.readthedocs.io\/en\/1.0-maint\/ref\/request-response.html#django.http.HttpResponse\">HttpResponse<\/a>\u00a0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3055\u306d\u3070\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>redirect .include nclude\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4ed6\u306eurl.conf\u30d5\u30a1\u30a4\u30eb\u306b\u51e6\u7406\u3092\u4efb\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4f8b\u3048\u3070example.com\/contents\/0001.html\u306e\u3088\u3046\u306aURL\u304c\u3042\u3063\u305f\u3068\u304d\u3001\u6700<\/p>\n","protected":false},"author":1,"featured_media":361,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jin_ogp_image_url":"","_jin_last_featured_id":0,"footnotes":""},"categories":[8],"tags":[],"class_list":["post-512","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-django"],"_links":{"self":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/512","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=512"}],"version-history":[{"count":3,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/512\/revisions"}],"predecessor-version":[{"id":1425,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/posts\/512\/revisions\/1425"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=\/wp\/v2\/media\/361"}],"wp:attachment":[{"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=512"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=512"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agile-software.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=512"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}