{"id":531,"date":"2021-02-13T20:33:33","date_gmt":"2021-02-13T11:33:33","guid":{"rendered":"https:\/\/deskplate.net\/blog\/2021\/02\/13\/python-apache-%e9%80%a3%e6%90%ba\/"},"modified":"2024-03-10T21:03:38","modified_gmt":"2024-03-10T12:03:38","slug":"python-apache-%e9%80%a3%e6%90%ba","status":"publish","type":"post","link":"https:\/\/deskplate.net\/blog\/archives\/531","title":{"rendered":"Python Apache \u9023\u643a"},"content":{"rendered":"<p># dnf install httpd-devel<br \/>\n# dnf -y install python3-mod_wsgi<br \/>\n# pip install mod-wsgi<br \/>\n# pip install mod-wsgi-httpd<br \/>\n# vi \/etc\/httpd\/conf\/httpd.conf<br \/>\nAddHandler wsgi-script .py<br \/>\nAddHandler wsgi-script .wsgi<br \/>\n\u5b9f\u884c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f<br \/>\nOptions +ExecCGI  \u306b\u3057\u3066\u304a\u304f\u3053\u3068<br \/>\n# systemctl restart httpd.service<br \/>\n\u3053\u3093\u306a\u306e\u3092\u30a2\u30c3\u30d7\u3057\u3066\u78ba\u8a8d<br \/>\ntest.py<\/p>\n<pre>\r\ndef application(environ, start_response):\r\n    status = '200 OK'\r\n    html = '&lt;html&gt;\\n' \\\r\n           '&lt;body&gt;\\n' \\\r\n           '&lt;div style=\"width: 100%; font-size: 40px; font-weight: bold; text-align: center;\"&gt;\\n' \\\r\n           'WSGI \u30c6\u30b9\u30c8\u30da\u30fc\u30b8\\n' \\\r\n           '&lt;\/div&gt;\\n' \\\r\n           '&lt;\/body&gt;\\n' \\\r\n           '&lt;\/html&gt;\\n'.encode(\"utf-8\")\r\n    response_header = [('Content-type','text\/html')]\r\n    start_response(status,response_header)\r\n    return [html]\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p># dnf install httpd-<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[],"class_list":["post-531","post","type-post","status-publish","format-standard","hentry","category-python"],"_links":{"self":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/531","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/comments?post=531"}],"version-history":[{"count":4,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/531\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/posts\/531\/revisions\/728"}],"wp:attachment":[{"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/media?parent=531"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/categories?post=531"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deskplate.net\/blog\/wp-json\/wp\/v2\/tags?post=531"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}