{"id":389,"date":"2019-11-30T08:25:29","date_gmt":"2019-11-30T05:25:29","guid":{"rendered":"http:\/\/is19-2017.susu.ru\/matveev\/?p=389"},"modified":"2019-11-30T08:25:29","modified_gmt":"2019-11-30T05:25:29","slug":"cherrypy-i-algoritm-po-ustanovke-na-hosting","status":"publish","type":"post","link":"https:\/\/is19-2017.susu.ru\/matveev\/2019\/11\/30\/cherrypy-i-algoritm-po-ustanovke-na-hosting\/","title":{"rendered":"CherryPy \u0438 \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433"},"content":{"rendered":"<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f CherryPy \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0435\u0439 Python (Windows, MacOS, Linux \u0438 \u0442.\u0434.). CherryPy \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0438 \u0442.\u0434. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0435\u043c, \u043a\u0430\u043a \u0441 \u043b\u0451\u0433\u043a\u043e\u0441\u0442\u044c\u044e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u0435.<\/p>\n<p><strong>\u0428\u0430\u0433 1.<\/strong> \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0434\u043e\u043c\u0435\u043d\u0430 , \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b SSH \u0447\u0435\u0440\u0435\u0437 \u043f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0445\u043e\u0441\u0442\u0438\u043d\u0433\u043e\u043c \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u041e\u0442\u043a\u0440\u044b\u0442\u044c SSH \u043a\u043b\u0438\u0435\u043d\u0442. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u043b\u0438\u0430\u0441\u043e\u0432 (\u044d\u0442\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0434\u043e\u043c\u0435\u043d\u044b \u0434\u043b\u044f \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430.):<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\necho &quot;alias python=&#039;\/opt\/python3\/bin\/python3.*&#039;&quot; &amp;gt;&amp;gt; ~\/.bashrc\r\necho &quot;alias pip=&#039;\/opt\/python3\/bin\/pip3.*&#039;&quot; &amp;gt;&amp;gt; ~\/.bashrc\r\necho &quot;alias virtualenv=&#039;\/opt\/python3\/bin\/virtualenv&#039;&quot; &amp;gt;&amp;gt; ~\/.bashrc\r\nsource ~\/.bashrc\r\n<\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043c\u043e\u0434\u0443\u043b\u0438:<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\ncd cherrypy-test.com\/htdocs\/www\r\nvirtualenv virtualenv\r\nsource virtualenv\/bin\/activate\r\n<\/pre>\n<p><strong>\u0428\u0430\u0433 2.<\/strong> \u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 CherryPy \u0412\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0430\u043a\u0435\u0442\u043d\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 pip. \u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440 pip \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u043c\u0438:<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\n.\/virtualenv\/bin\/pip install cherrypy\r\n<\/pre>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u043a\u0435\u0442\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438\u0441\u044c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e ~\/cherrypy-test.com\/htdocs\/www\/virtualenv\/lib\/python3.*\/site-packages. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430.<\/p>\n<p><strong>\u0428\u0430\u0433 3.<\/strong> \u041e\u0442\u043a\u0440\u043e\u0435\u043c \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 \u0438 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u043c \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u0443\u044e \u0432\u044b\u0448\u0435 (~\/cherrypy-test.com\/htdocs\/www\/virtualenv\/lib\/python3.*\/site-packages).<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b hello.py \u0438 \u043d\u0430\u043f\u043e\u043b\u043d\u0438\u043c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\nimport cherrypy\r\n\r\nclass HelloWorld:\r\n    &quot;&quot;&quot; Sample request handler class. &quot;&quot;&quot;\r\n\r\n    def index(self, **params):\r\n        for key in params:\r\n        \tprint (key, &#039;=&#039;, params[key])\r\n        return &quot;Hello world!&quot;\r\n        \r\n    index.exposed = True\r\n    \r\ncherrypy.config.update({&#039;server.socket_host&#039;: &#039;\u0412\u043d\u0435\u0448\u043d\u0438\u0439 ip-\u0430\u0434\u0440\u0435\u0441&#039;})\r\ncherrypy.config.update({&#039;server.socket_port&#039;: 8000})\r\ncherrypy.quickstart(HelloWorld(), &#039;\/&#039;)\r\n<\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0443\u0437\u043d\u0430\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0439 ip-\u0430\u0434\u0440\u0435\u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c ping-\u0437\u0430\u043f\u0440\u043e\u0441 \u0438\u043b\u0438 \u043f\u043e\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <\/p>\n<pre class=\"wp-code-highlight prettyprint\">ifconfig -a<\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u0432 Web SSH \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<pre class=\"wp-code-highlight prettyprint\">\r\ncd .\/virtualenv\/lib\/python3.6\/site-packages\r\npython hello.py\r\n<\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0412\u0430\u0448 \u0441\u0430\u0439\u0442 \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8000 - \u0435\u0441\u043b\u0438 \u0412\u044b \u0432\u0438\u0434\u0438\u0442\u0435 Hello World!, \u0430 \u0432 Web SSH \u043e\u0442\u0434\u0430\u0451\u0442\u0441\u044f response \u0441 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430\u043c\u0438, \u0442\u043e \u0412\u044b \u0432\u0441\u0451 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0432\u0435\u0440\u043d\u043e. \u0424\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0433\u043e\u0442\u043e\u0432 \u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f CherryPy \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u043b\u044e\u0431\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0449\u0435\u0439 Python (Windows, MacOS, Linux \u0438 \u0442.\u0434.). CherryPy \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f&hellip;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[9],"tags":[],"_links":{"self":[{"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/posts\/389"}],"collection":[{"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/comments?post=389"}],"version-history":[{"count":6,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/posts\/389\/revisions"}],"predecessor-version":[{"id":395,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/posts\/389\/revisions\/395"}],"wp:attachment":[{"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/media?parent=389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/categories?post=389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/is19-2017.susu.ru\/matveev\/wp-json\/wp\/v2\/tags?post=389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}