{"id":1647,"date":"2018-03-22T20:02:08","date_gmt":"2018-03-22T11:02:08","guid":{"rendered":"http:\/\/www.python.ambitious-engineer.com\/?p=1647"},"modified":"2018-11-04T22:37:06","modified_gmt":"2018-11-04T13:37:06","slug":"flask%e3%81%a7%e4%bd%9c%e3%82%8b%e7%b0%a1%e6%98%93%e5%88%86%e6%9e%90%e3%83%84%e3%83%bc%e3%83%ab3-mock%e3%81%ae%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.python.ambitious-engineer.com\/archives\/1647","title":{"rendered":"Flask\u3067\u4f5c\u308b\u7c21\u6613\u5206\u6790\u30c4\u30fc\u30eb3 mock\u306e\u4f5c\u6210"},"content":{"rendered":"<p>\u524d\u56de\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u96db\u5f62\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u914d\u7f6e\u3057\u307e\u3057\u305f\u3002\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3059\u308b\u969b\u3001\u79c1\u306f\u307e\u305a\u52d5\u304f\u72b6\u614b\u306b\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u306e\u305f\u3081\u3001\u4eca\u56de\u306fmock\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h2>\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210<\/h2>\n<p>templates\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u914d\u4e0b\u306b\u3042\u308bhtml\u30d5\u30a1\u30a4\u30eb\u3092\u8a18\u8ff0\u3057\u3066mock\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002\u5148\u306b\u4e88\u9632\u7dda\u3092\u5f35\u3063\u3066\u304a\u304d\u307e\u3059\u304c\u3001\u79c1\u306f\u30d5\u30ed\u30f3\u30c8\u306f\u305d\u308c\u307b\u3069\u8a73\u3057\u304f\u306a\u3044\u305f\u3081\u3001\u66f8\u304d\u65b9\u3084\u30c7\u30b6\u30a4\u30f3\u304c\u30a4\u30de\u30a4\u30c1\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002\u5927\u76ee\u306b\u898b\u3066\u3044\u305f\u3060\u3051\u308b\u3068\u5e78\u3044\u3067\u3059\u3002<\/p>\n<h3>\u5171\u901a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210<\/h3>\n<p>\u307e\u305a\u306f\u89aa\u3068\u306a\u308b\u5171\u901a\u70b9\u30d7\u30ec\u30fc\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002\u30d5\u30ed\u30f3\u30c8\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306bbootstrap4\u306eCDN\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092base.html\u306b\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!doctype html&gt;\r\n&lt;title&gt;\u7c21\u6613\u5206\u6790\u30c4\u30fc\u30eb&lt;\/title&gt;\r\n&lt;head&gt;\r\n    &lt;title&gt;\u7c21\u6613\u5206\u6790\u30c4\u30fc\u30eb&lt;\/title&gt;\r\n    &lt;script src=&quot;https:\/\/code.jquery.com\/jquery-3.2.1.slim.min.js&quot;\r\n            integrity=&quot;sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr\/rE9\/Qpg6aAZGJwFDMVNA\/GpGFF93hXpG5KkN&quot;\r\n            crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt;\r\n    &lt;script src=&quot;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/popper.js\/1.12.9\/umd\/popper.min.js&quot;\r\n            integrity=&quot;sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K\/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q&quot;\r\n            crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt;\r\n    &lt;script src=&quot;https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/4.0.0\/js\/bootstrap.min.js&quot;\r\n            integrity=&quot;sha384-JZR6Spejh4U02d8jOt6vLEHfe\/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl&quot;\r\n            crossorigin=&quot;anonymous&quot;&gt;&lt;\/script&gt;\r\n    &lt;link rel=&quot;stylesheet&quot; href=&quot;https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/4.0.0\/css\/bootstrap.min.css&quot;\r\n          integrity=&quot;sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW\/dAiS6JXm&quot; crossorigin=&quot;anonymous&quot;&gt;\r\n    &lt;link rel=&quot;stylesheet&quot; type=text\/css href=&quot;{{ url_for('static', filename='style.css') }}&quot;&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;header&gt;\r\n    &lt;div class=&quot;navbar navbar-dark bg-dark box-shadow&quot;&gt;\r\n        &lt;div class=&quot;container d-flex justify-content-between&quot;&gt;\r\n            &lt;a href=&quot;\/&quot; class=&quot;navbar-brand d-flex align-items-center&quot;&gt;\r\n                &lt;strong&gt;\u7c21\u6613\u5206\u6790\u30c4\u30fc\u30eb&lt;\/strong&gt;\r\n            &lt;\/a&gt;\r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/header&gt;\r\n\r\n&lt;div class=&quot;container&quot;&gt;\r\n    {% block body %}\r\n    {% endblock %}\r\n&lt;\/div&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>\uff11\uff16\u884c\u76ee\u306e{{ url_for('static', filename='style.css') }}\u3067\u3059\u304c\u3001\u3053\u308c\u306fstatic\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306estyle.css\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>index.html<\/h3>\n<p>\u3053\u3053\u304b\u3089\u306f\u5b50\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210\u3092\u884c\u3044\u307e\u3059\u3002index.html\u306b\u4ee5\u4e0b\u3092\u30b3\u30d4\u30fc\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n{% extends &quot;base.html&quot; %}\r\n{% block body %}\r\n&lt;h1&gt;\u5206\u6790\u4e00\u89a7&lt;\/h1&gt;\r\n&lt;a href=&quot;\/create&quot;&gt;\u65b0\u898f\u5206\u6790&lt;\/a&gt;\r\n&lt;table class=&quot;table table-striped table-hover&quot;&gt;\r\n    &lt;tr&gt;\r\n        &lt;th&gt;id&lt;\/th&gt;\r\n        &lt;th&gt;title&lt;\/th&gt;\r\n        &lt;th&gt;date&lt;\/th&gt;\r\n        &lt;th&gt;\u64cd\u4f5c&lt;\/th&gt;\r\n    &lt;\/tr&gt;\r\n    &lt;tr&gt;\r\n        &lt;td&gt;0&lt;\/td&gt;\r\n        &lt;td&gt;\u30b5\u30f3\u30d7\u30eb\u30bf\u30a4\u30c8\u30eb&lt;\/td&gt;\r\n        &lt;td&gt;2020\/01\/01 12:00&lt;\/td&gt;\r\n        &lt;td&gt;\r\n            &lt;a href=&quot;\/delete\/0&quot;&gt;\u524a\u9664&lt;\/a&gt;\r\n            &lt;a href=&quot;\/view\/0&quot;&gt;\u53c2\u7167&lt;\/a&gt;\r\n        &lt;\/td&gt;\r\n    &lt;\/tr&gt;\r\n\r\n&lt;\/table&gt;\r\n\r\n\r\n{% endblock %}\r\n<\/pre>\n<p>\uff11\u884c\u76ee\u3067\u5171\u901a\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u7d99\u627f\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3>edit.html<\/h3>\n<p>\u6b21\u306b\u5206\u6790\u4f5c\u6210\u753b\u9762\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u3002edit.html\u306b\u4ee5\u4e0b\u3092\u30b3\u30d4\u30fc\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n{% extends &quot;base.html&quot; %}\r\n{% block body %}\r\n&lt;h1&gt;\u65b0\u898f\u5206\u6790&lt;\/h1&gt;\r\n&lt;form action=&quot;{{ url_for('analysis') }}&quot; method=&quot;post&quot;&gt;\r\n\r\n    &lt;label&gt;\u30bf\u30a4\u30c8\u30eb&lt;\/label&gt;\r\n    &lt;input class=&quot;form-control&quot; type=&quot;text&quot; size=&quot;30&quot; name=&quot;title&quot;&gt;\r\n    &lt;label&gt;\u5206\u6790\u30c7\u30fc\u30bf&lt;\/label&gt;\r\n    &lt;textarea class=&quot;form-control&quot; name=&quot;data&quot; rows=&quot;5&quot;&gt;&lt;\/textarea&gt;\r\n    &lt;input class=&quot;btn btn-primary&quot; type=&quot;submit&quot; value=&quot;\u9001\u4fe1&quot;&gt;\r\n\r\n&lt;\/form&gt;\r\n{% endblock %}\r\n<\/pre>\n<h3>view.html<\/h3>\n<p>\u6700\u5f8c\u306b\u5206\u6790\u53c2\u7167\u753b\u9762\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u3059\u3002view.html\u306b\u4ee5\u4e0b\u3092\u30b3\u30d4\u30fc\u30da\u30fc\u30b9\u30c8\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n{% extends &quot;base.html&quot; %}\r\n{% block body %}\r\n&lt;h1&gt;\u7d50\u679c\u53c2\u7167&lt;\/h1&gt;\r\n\r\n&lt;h3&gt;0:\u30b5\u30f3\u30d7\u30eb\u30bf\u30a4\u30c8\u30eb&lt;\/h3&gt;\r\n&lt;p&gt;2020\/01\/01 12:00&lt;\/p&gt;\r\n&lt;div class=&quot;row&quot;&gt;\r\n    \u3053\u3053\u306b\u30b0\u30e9\u30d5\u3092\u914d\u7f6e\r\n&lt;\/div&gt;\r\n\r\n&lt;div class=&quot;row&quot;&gt;\r\n    &lt;textarea class=&quot;form-control&quot; name=&quot;data&quot; rows=&quot;5&quot;&gt;\u30c6\u30b9\u30c8\u30c7\u30fc\u30bf&lt;\/textarea&gt;\r\n&lt;\/div&gt;\r\n\r\n&lt;br&gt;&lt;br&gt;\r\n{% endblock %}\r\n<\/pre>\n<h2>mock\u306e\u8d77\u52d5<\/h2>\n<p>\u305d\u308c\u3067\u306f\u3001flask\u3092\u8d77\u52d5\u3057\u3066mock\u3092\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u304b\u78ba\u8a8d\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\npython run.py\r\n<\/pre>\n<p>http:\/\/localhost:5000\u3082\u3057\u304f\u306fhttp:\/\/127.0.0.1:5000\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u4ee5\u4e0b\u306e\u753b\u9762\u304c\u53c2\u7167\u3067\u304d\u308c\u3070\u6210\u529f\u3067\u3059\u3002<br \/>\n<a href=\"http:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index.png\"><img loading=\"lazy\" src=\"http:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index.png\" alt=\"\" width=\"1237\" height=\"854\" class=\"alignnone size-full wp-image-1684\" srcset=\"https:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index.png 1237w, https:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index-300x207.png 300w, https:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index-768x530.png 768w, https:\/\/www.python.ambitious-engineer.com\/wp-content\/uploads\/2018\/03\/flask_mock_index-1024x707.png 1024w\" sizes=\"(max-width: 1237px) 100vw, 1237px\" \/><\/a><\/p>\n<p>\u30ea\u30f3\u30af\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u753b\u9762\u3092\u9077\u79fb\u3067\u304d\u308b\u304b\u3082\u8a66\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u96db\u5f62\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u914d\u7f6e\u3057\u307e\u3057\u305f\u3002\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u3059\u308b\u969b\u3001\u79c1\u306f\u307e\u305a\u52d5\u304f\u72b6\u614b\u306b\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u306e\u305f\u3081\u3001\u4eca\u56de\u306fmock\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u4f5c\u6210 templates\u30c7\u30a3...<\/p>\n","protected":false},"author":1,"featured_media":1716,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[153,3,9],"tags":[171,170],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1647"}],"collection":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/comments?post=1647"}],"version-history":[{"count":8,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1647\/revisions"}],"predecessor-version":[{"id":1969,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/posts\/1647\/revisions\/1969"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media\/1716"}],"wp:attachment":[{"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/media?parent=1647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/categories?post=1647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.python.ambitious-engineer.com\/wp-json\/wp\/v2\/tags?post=1647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}