{"id":221659,"date":"2014-05-03T01:52:02","date_gmt":"2014-05-02T21:52:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=221659"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=221659","title":{"rendered":"<span class=\"post_title\">\u041b\u0435\u0433\u043a\u0438\u0439 python \u0432\u0435\u0431-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a: Bottle<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u043c\u0443 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 Bottle, \u043a\u043e\u0442\u043e\u0440\u044b\u043c, \u043a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u043c\u0430\u043b\u043e \u043b\u044e\u0434\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u043d\u0435\u043c.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  Bottle \u2014 \u043e\u0447\u0435\u043d\u044c \u043b\u0435\u0433\u043a\u0438\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u2014 bottle.py. \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/pypi.python.org\/pypi\/bottle\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>, \u043b\u0438\u0431\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c pip install bottle.<\/p>\n<h4>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h4>\n<p>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0441\u0432\u043e\u044e \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c, Bottle \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0448\u0438\u0440\u043e\u043a\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0430 100% \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043c\u0435\u043b\u043a\u0438\u0445 \u0438 \u0441\u0440\u0435\u0434\u043d\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u0412\u043e\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439:<\/p>\n<h5>Routing<\/h5>\n<p>  \u0420\u043e\u0443\u0442\u0438\u043d\u0433 \u0432 bottle, \u043a\u0430\u043a \u0438 \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u043d\u0430 \u043f\u0438\u0442\u043e\u043d\u0435, \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"python\">@route('\/hello\/&lt;name&gt;') def index(name):     return name <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0435 url \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0445 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439:  <\/p>\n<pre><code class=\"python\">@route('\/news\/&lt;number:re:[0-9]*&gt;') def show_news(number):     pass <\/code><\/pre>\n<p>  <\/p>\n<h5>Templates<\/h5>\n<p>  \u041e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0438\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u2014 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043b\u0435\u0433\u043a\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"python\">template('template_name', name=name, number=number, foo=bar) <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0442\u0435\u043a\u0441\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0448\u0430\u0431\u043b\u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f template_name.tpl).<br \/>  \u0412 \u0441\u0430\u043c\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0432 \u0434\u0432\u0443\u0445 \u0444\u0438\u0433\u0443\u0440\u043d\u044b\u0445 \u0441\u043a\u043e\u0431\u043a\u0430\u0445:  <\/p>\n<pre><code class=\"html\">Hello, {{name}}, glad to see you! <\/code><\/pre>\n<p>  \u041f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0442\u0430\u043a, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0432 \u0441\u043a\u043e\u0431\u043a\u0430\u0445 \u0443\u043a\u0430\u0437\u0430\u043d html \u043a\u043e\u0434, \u0442\u043e \u043e\u043d \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f, \u0432\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u0435 XSS \u0430\u0442\u0430\u043a. \u0415\u0441\u043b\u0438 \u0436\u0435 \u043d\u0430\u043c \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0434\u043e, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c {{!name}}. \u0422\u0430\u043a\u0436\u0435 Bottle \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0443\u0442\u0443\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c: \u043f\u0438\u0441\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 python \u043a\u043e\u0434 \u0432\u043d\u0443\u0442\u0440\u0438 \u0448\u0430\u0431\u043b\u043e\u043d\u0430. \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043f\u0438\u0442\u043e\u043d, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c %. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"html\">%a = 100500 %for i in xrange(a):     &lt;div class=&quot;image_{{i}}&quot;&gt;&lt;img src=&quot;......{{i}}.jpg&quot;&gt;&lt;\/div&gt; %end  <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u043d\u043a\u043b\u044e\u0434\u0438\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438\u0437 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438 \u043e\u043f\u0440\u044f\u0442\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d\u044b.  <\/p>\n<pre><code class=\"python\">%include template_num2 foo=bar, blabla=qweqwe <\/code><\/pre>\n<p>  <\/p>\n<h5>POST-routing \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0444\u043e\u0440\u043c<\/h5>\n<p>  \u041a\u0430\u043a\u043e\u0439 \u0436\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u043c\u043e\u0436\u0435\u0442 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 POST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0444\u043e\u0440\u043c?<br \/>  \u041c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 POST \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 GET \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u043e\u0432\u043e route \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 post:  <\/p>\n<pre><code class=\"python\">@post(&quot;\/url&quot;) def foo():     pass <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0444\u043e\u0440\u043c\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043f\u043e\u043b\u0435\u0439 \u00abname\u00bb. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:  <\/p>\n<pre><code class=\"html\">&lt;input name=&quot;age&quot; placeholder=&quot;\u0412\u043e\u0437\u0440\u0430\u0441\u0442&quot;&gt; <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u043e\u0440\u043c\u044b, \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e:  <\/p>\n<pre><code class=\"python\">request.forms.get(&quot;age&quot;)  # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044f age request.forms.getall(&quot;age&quot;)  # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u0441\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 age <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0438 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438:  <\/p>\n<pre><code class=\"python\">request.files.get(&quot;picture&quot;)  # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u0438\u0437 \u043f\u043e\u043b\u044f picture request.files.getall(&quot;picture&quot;)  # \u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0444\u0430\u0439\u043b\u044b \u0438\u0437 \u043f\u043e\u043b\u044f (mult-upload) <\/code><\/pre>\n<p>  <\/p>\n<h5>Cookies<\/h5>\n<p>  \u041e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 Cookies \u0432 bottle \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c cookie:  <\/p>\n<pre><code class=\"python\">response.set_cookie(&quot;name&quot;, value, max_age=100500) <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0432\u0437\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435:  <\/p>\n<pre><code class=\"python\">request.get_cookie(&quot;name&quot;) <\/code><\/pre>\n<p>  <\/p>\n<h5>\u0421\u0435\u0440\u0432\u0435\u0440<\/h5>\n<p>  \u0412 bottle \u0432\u0448\u0438\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 http \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0433\u043e\u0434\u0435\u043d \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0434\u043b\u044f \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u0438:  <\/p>\n<pre><code class=\"python\">run(host='localhost', port=8080) <\/code><\/pre>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0434\u043e \u043a\u0430\u043a-\u0442\u043e \u0441\u0432\u044f\u0437\u0430\u0442\u044c bottle \u0441 apache \u0438\u043b\u0438 nginx. \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0441\u0430\u043c \u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e apache, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u043e\u0433\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e \u043d\u0435\u0433\u043e, \u043d\u043e \u0441 ngninx \u0432\u0441\u0435 \u0442\u043e\u0436\u0435 \u0432\u0440\u043e\u0434\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e. Bottle \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0441 Apache \u0447\u0435\u0440\u0435\u0437 mod_wsgi. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<ol>\n<li>\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b adapter.wsgi \u0441 \u0432\u043e\u0442 \u0442\u0430\u043a\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import sys, os, bottle sys.path.append(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__))) import index # \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b  application = bottle.default_app() <\/code><\/pre>\n<p>   <\/div>\n<\/div>\n<\/li>\n<li>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0438 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c mod_wsgi<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0445\u043e\u0441\u0442\u0430\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0441\u043f\u043e\u0439\u043b\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"apache\">&lt;VirtualHost *:80&gt;         DocumentRoot \/var\/www\/foo &lt;\/VirtualHost&gt;  &lt;Directory \/var\/www\/foo&gt;         Options FollowSymLinks ExecCGI         AddHandler wsgi-script .wsgi         Order allow,deny         AllowOverride All         Allow from all &lt;\/Directory&gt; <\/code><\/pre>\n<\/p><\/div>\n<\/div>\n<\/li>\n<\/ol>\n<p>  <\/p>\n<h4>\u0427\u0430\u0441\u0442\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u0438\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u0441\u0430\u0439\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 apache, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u043f\u0443\u0442\u044f\u043c\u0438, \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u043f\u0443\u0442\u0438. \u041c\u043e\u0439 \u0432\u0430\u043c \u0441\u043e\u0432\u0435\u0442: \u0433\u0434\u0435-\u043d\u0438\u0431\u0443\u0434\u044c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u043e\u0434\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0430 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0437\u0434\u0435 \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0442\u0430\u043a:<br \/> \n<pre><code class=\"python\">sys.path.append(os.path.dirname(os.path.abspath(__file__))) os.chdir(os.path.dirname(os.path.abspath(__file__))) cwd = os.getcwd() <\/code><\/pre>\n<p>  <\/li>\n<li> \u0415\u0441\u043b\u0438 \u0432\u044b \u0431\u0435\u0440\u0435\u0442\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u044b \u0438\u0437 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0430\u043f\u043a\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 views), \u0442\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043f\u0443\u0442\u044c \u0434\u043e \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0438 \u0432 \u0441\u043f\u0438\u0441\u043e\u043a bottle.TEMPLATE_PATH <\/li>\n<\/ul>\n<p>  <\/p>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u0415\u0441\u0442\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0441\u043b\u043e\u0436\u043d\u043e \u0432 \u043e\u0434\u0438\u043d \u043f\u043e\u0441\u0442 \u0443\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0435, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043b\u0438\u0448\u044c \u0441\u0430\u043c\u043e\u0435 \u0433\u043b\u0430\u0432\u043d\u043e\u0435. \u0411\u043b\u0430\u0433\u043e bottle \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448\u0435\u0439 <a href=\"http:\/\/bottlepy.org\/docs\/0.12\/bottle-docs.pdf\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439<\/a>, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u0430\u0445\u043e\u0434\u0438\u0442\u0435 \u0438 \u0447\u0438\u0442\u0430\u0439\u0442\u0435. \u0425\u043e\u0440\u043e\u0448\u0438\u0445 \u0432\u0441\u0435\u043c \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0445!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/221659\/\"> http:\/\/habrahabr.ru\/post\/221659\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h4>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h4>\n<p>  \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u044f \u043e\u0441\u043e\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043d\u0435\u0442 \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u043e\u0439 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u043c\u0443 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0443 Bottle, \u043a\u043e\u0442\u043e\u0440\u044b\u043c, \u043a\u0441\u0442\u0430\u0442\u0438 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 \u043c\u0430\u043b\u043e \u043b\u044e\u0434\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043f\u044b\u0442\u0430\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u043e \u043d\u0435\u043c.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-221659","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/221659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221659"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/221659\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}