diff options
Diffstat (limited to 'studio/static/doc/flask-docs/deploying')
-rw-r--r-- | studio/static/doc/flask-docs/deploying/cgi.html | 153 | ||||
-rw-r--r-- | studio/static/doc/flask-docs/deploying/fastcgi.html | 259 | ||||
-rw-r--r-- | studio/static/doc/flask-docs/deploying/index.html | 150 | ||||
-rw-r--r-- | studio/static/doc/flask-docs/deploying/mod_wsgi.html | 255 | ||||
-rw-r--r-- | studio/static/doc/flask-docs/deploying/others.html | 200 | ||||
-rw-r--r-- | studio/static/doc/flask-docs/deploying/uwsgi.html | 167 |
6 files changed, 0 insertions, 1184 deletions
diff --git a/studio/static/doc/flask-docs/deploying/cgi.html b/studio/static/doc/flask-docs/deploying/cgi.html deleted file mode 100644 index 0471329..0000000 --- a/studio/static/doc/flask-docs/deploying/cgi.html +++ /dev/null @@ -1,153 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>CGI — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="up" title="Deployment Options" href="index.html" /> - <link rel="next" title="FastCGI" href="fastcgi.html" /> - <link rel="prev" title="mod_wsgi (Apache)" href="mod_wsgi.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="fastcgi.html" title="FastCGI" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="mod_wsgi.html" title="mod_wsgi (Apache)" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - <li><a href="index.html" accesskey="U">Deployment Options</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="cgi"> -<h1>CGI<a class="headerlink" href="#cgi" title="Permalink to this headline">¶</a></h1> -<p>If all other deployment methods do not work, CGI will work for sure. -CGI is supported by all major servers but usually has a sub-optimal -performance.</p> -<p>This is also the way you can use a Flask application on Google’s <a class="reference external" href="http://code.google.com/appengine/">App -Engine</a>, where execution happens in a CGI-like environment.</p> -<div class="admonition-watch-out admonition "> -<p class="first admonition-title">Watch Out</p> -<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might -have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> -<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it’s -not called because this will always start a local WSGI server which -we do not want if we deploy that application to CGI / app engine.</p> -</div> -<div class="section" id="creating-a-cgi-file"> -<h2>Creating a <cite>.cgi</cite> file<a class="headerlink" href="#creating-a-cgi-file" title="Permalink to this headline">¶</a></h2> -<p>First you need to create the CGI application file. Let’s call it -<cite>yourapplication.cgi</cite>:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span> -<span class="kn">from</span> <span class="nn">wsgiref.handlers</span> <span class="kn">import</span> <span class="n">CGIHandler</span> -<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> - -<span class="n">CGIHandler</span><span class="p">()</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">app</span><span class="p">)</span> -</pre></div> -</div> -</div> -<div class="section" id="server-setup"> -<h2>Server Setup<a class="headerlink" href="#server-setup" title="Permalink to this headline">¶</a></h2> -<p>Usually there are two ways to configure the server. Either just copy the -<cite>.cgi</cite> into a <cite>cgi-bin</cite> (and use <cite>mod_rewrite</cite> or something similar to -rewrite the URL) or let the server point to the file directly.</p> -<p>In Apache for example you can put a like like this into the config:</p> -<div class="highlight-apache"><div class="highlight"><pre><span class="nb">ScriptAlias</span> <span class="sx">/app</span> <span class="sx">/path/to/the/application.cgi</span> -</pre></div> -</div> -<p>For more information consult the documentation of your webserver.</p> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">CGI</a><ul> -<li><a class="reference internal" href="#creating-a-cgi-file">Creating a <cite>.cgi</cite> file</a></li> -<li><a class="reference internal" href="#server-setup">Server Setup</a></li> -</ul> -</li> -</ul> -<h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li><a href="index.html">Deployment Options</a><ul> - <li>Previous: <a href="mod_wsgi.html" title="previous chapter">mod_wsgi (Apache)</a></li> - <li>Next: <a href="fastcgi.html" title="next chapter">FastCGI</a></li> - </ul></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/cgi.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file diff --git a/studio/static/doc/flask-docs/deploying/fastcgi.html b/studio/static/doc/flask-docs/deploying/fastcgi.html deleted file mode 100644 index 7431826..0000000 --- a/studio/static/doc/flask-docs/deploying/fastcgi.html +++ /dev/null @@ -1,259 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>FastCGI — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="up" title="Deployment Options" href="index.html" /> - <link rel="next" title="uWSGI" href="uwsgi.html" /> - <link rel="prev" title="CGI" href="cgi.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="uwsgi.html" title="uWSGI" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="cgi.html" title="CGI" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - <li><a href="index.html" accesskey="U">Deployment Options</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="fastcgi"> -<span id="deploying-fastcgi"></span><h1>FastCGI<a class="headerlink" href="#fastcgi" title="Permalink to this headline">¶</a></h1> -<p>FastCGI is a deployment option on servers like <a class="reference external" href="http://nginx.org/">nginx</a>, <a class="reference external" href="http://www.lighttpd.net/">lighttpd</a>, -and <a class="reference external" href="http://www.cherokee-project.com/">cherokee</a>; see <a class="reference internal" href="uwsgi.html#deploying-uwsgi"><em>uWSGI</em></a> and -<a class="reference internal" href="others.html#deploying-other-servers"><em>Other Servers</em></a> for other options. To use your WSGI -application with any of them you will need a FastCGI server first. The -most popular one is <a class="reference external" href="http://trac.saddi.com/flup">flup</a> which we will use for this guide. Make sure -to have it installed to follow along.</p> -<div class="admonition-watch-out admonition "> -<p class="first admonition-title">Watch Out</p> -<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might -have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> -<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it’s -not called because this will always start a local WSGI server which -we do not want if we deploy that application to FastCGI.</p> -</div> -<div class="section" id="creating-a-fcgi-file"> -<h2>Creating a <cite>.fcgi</cite> file<a class="headerlink" href="#creating-a-fcgi-file" title="Permalink to this headline">¶</a></h2> -<p>First you need to create the FastCGI server file. Let’s call it -<cite>yourapplication.fcgi</cite>:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="c">#!/usr/bin/python</span> -<span class="kn">from</span> <span class="nn">flup.server.fcgi</span> <span class="kn">import</span> <span class="n">WSGIServer</span> -<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> - -<span class="k">if</span> <span class="n">__name__</span> <span class="o">==</span> <span class="s">'__main__'</span><span class="p">:</span> - <span class="n">WSGIServer</span><span class="p">(</span><span class="n">app</span><span class="p">)</span><span class="o">.</span><span class="n">run</span><span class="p">()</span> -</pre></div> -</div> -<p>This is enough for Apache to work, however nginx and older versions of -lighttpd need a socket to be explicitly passed to communicate with the -FastCGI server. For that to work you need to pass the path to the -socket to the <tt class="xref py py-class docutils literal"><span class="pre">WSGIServer</span></tt>:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="n">WSGIServer</span><span class="p">(</span><span class="n">application</span><span class="p">,</span> <span class="n">bindAddress</span><span class="o">=</span><span class="s">'/path/to/fcgi.sock'</span><span class="p">)</span><span class="o">.</span><span class="n">run</span><span class="p">()</span> -</pre></div> -</div> -<p>The path has to be the exact same path you define in the server -config.</p> -<p>Save the <cite>yourapplication.fcgi</cite> file somewhere you will find it again. -It makes sense to have that in <cite>/var/www/yourapplication</cite> or something -similar.</p> -<p>Make sure to set the executable bit on that file so that the servers -can execute it:</p> -<div class="highlight-text"><div class="highlight"><pre># chmod +x /var/www/yourapplication/yourapplication.fcgi -</pre></div> -</div> -</div> -<div class="section" id="configuring-lighttpd"> -<h2>Configuring lighttpd<a class="headerlink" href="#configuring-lighttpd" title="Permalink to this headline">¶</a></h2> -<p>A basic FastCGI configuration for lighttpd looks like that:</p> -<div class="highlight-python"><pre>fastcgi.server = ("/yourapplication.fcgi" => - (( - "socket" => "/tmp/yourapplication-fcgi.sock", - "bin-path" => "/var/www/yourapplication/yourapplication.fcgi", - "check-local" => "disable", - "max-procs" => 1 - )) -) - -alias.url = ( - "/static/" => "/path/to/your/static" -) - -url.rewrite-once = ( - "^(/static.*)$" => "$1", - "^(/.*)$" => "/yourapplication.fcgi$1"</pre> -</div> -<p>Remember to enable the FastCGI, alias and rewrite modules. This -configuration binds the application to <cite>/yourapplication</cite>. If you want -the application to work in the URL root you have to work around a -lighttpd bug with the -<a class="reference external" href="http://werkzeug.pocoo.org/docs/contrib/fixers/#werkzeug.contrib.fixers.LighttpdCGIRootFix" title="(in Werkzeug v0.7)"><tt class="xref py py-class docutils literal"><span class="pre">LighttpdCGIRootFix</span></tt></a> middleware.</p> -<p>Make sure to apply it only if you are mounting the application the URL -root. Also, see the Lighty docs for more information on <a class="reference external" href="http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModFastCGI">FastCGI and -Python</a> -(note that explicitly passing a socket to run() is no longer necessary).</p> -</div> -<div class="section" id="configuring-nginx"> -<h2>Configuring nginx<a class="headerlink" href="#configuring-nginx" title="Permalink to this headline">¶</a></h2> -<p>Installing FastCGI applications on nginx is a bit different because by -default no FastCGI parameters are forwarded.</p> -<p>A basic flask FastCGI configuration for nginx looks like this:</p> -<div class="highlight-python"><pre>location = /yourapplication { rewrite ^ /yourapplication/ last; } -location /yourapplication { try_files $uri @yourapplication; } -location @yourapplication { - include fastcgi_params; - fastcgi_split_path_info ^(/yourapplication)(.*)$; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_NAME $fastcgi_script_name; - fastcgi_pass unix:/tmp/yourapplication-fcgi.sock; -}</pre> -</div> -<p>This configuration binds the application to <cite>/yourapplication</cite>. If you -want to have it in the URL root it’s a bit simpler because you don’t -have to figure out how to calculate <cite>PATH_INFO</cite> and <cite>SCRIPT_NAME</cite>:</p> -<div class="highlight-python"><pre>location / { try_files $uri @yourapplication; } -location @yourapplication { - include fastcgi_params; - fastcgi_param PATH_INFO $fastcgi_script_name; - fastcgi_param SCRIPT_NAME ""; - fastcgi_pass unix:/tmp/yourapplication-fcgi.sock; -}</pre> -</div> -</div> -<div class="section" id="running-fastcgi-processes"> -<h2>Running FastCGI Processes<a class="headerlink" href="#running-fastcgi-processes" title="Permalink to this headline">¶</a></h2> -<p>Since Nginx and others do not load FastCGI apps, you have to do it by -yourself. <a class="reference external" href="http://supervisord.org/configuration.html#fcgi-program-x-section-settings">Supervisor can manage FastCGI processes.</a> -You can look around for other FastCGI process managers or write a script -to run your <cite>.fcgi</cite> file at boot, e.g. using a SysV <tt class="docutils literal"><span class="pre">init.d</span></tt> script. -For a temporary solution, you can always run the <tt class="docutils literal"><span class="pre">.fcgi</span></tt> script inside -GNU screen. See <tt class="docutils literal"><span class="pre">man</span> <span class="pre">screen</span></tt> for details, and note that this is a -manual solution which does not persist across system restart:</p> -<div class="highlight-python"><pre>$ screen -$ /var/www/yourapplication/yourapplication.fcgi</pre> -</div> -</div> -<div class="section" id="debugging"> -<h2>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline">¶</a></h2> -<p>FastCGI deployments tend to be hard to debug on most webservers. Very -often the only thing the server log tells you is something along the -lines of “premature end of headers”. In order to debug the application -the only thing that can really give you ideas why it breaks is switching -to the correct user and executing the application by hand.</p> -<p>This example assumes your application is called <cite>application.fcgi</cite> and -that your webserver user is <cite>www-data</cite>:</p> -<div class="highlight-python"><pre>$ su www-data -$ cd /var/www/yourapplication -$ python application.fcgi -Traceback (most recent call last): - File "yourapplication.fcgi", line 4, in <module> -ImportError: No module named yourapplication</pre> -</div> -<p>In this case the error seems to be “yourapplication” not being on the -python path. Common problems are:</p> -<ul class="simple"> -<li>Relative paths being used. Don’t rely on the current working directory</li> -<li>The code depending on environment variables that are not set by the -web server.</li> -<li>Different python interpreters being used.</li> -</ul> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">FastCGI</a><ul> -<li><a class="reference internal" href="#creating-a-fcgi-file">Creating a <cite>.fcgi</cite> file</a></li> -<li><a class="reference internal" href="#configuring-lighttpd">Configuring lighttpd</a></li> -<li><a class="reference internal" href="#configuring-nginx">Configuring nginx</a></li> -<li><a class="reference internal" href="#running-fastcgi-processes">Running FastCGI Processes</a></li> -<li><a class="reference internal" href="#debugging">Debugging</a></li> -</ul> -</li> -</ul> -<h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li><a href="index.html">Deployment Options</a><ul> - <li>Previous: <a href="cgi.html" title="previous chapter">CGI</a></li> - <li>Next: <a href="uwsgi.html" title="next chapter">uWSGI</a></li> - </ul></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/fastcgi.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file diff --git a/studio/static/doc/flask-docs/deploying/index.html b/studio/static/doc/flask-docs/deploying/index.html deleted file mode 100644 index 44127c0..0000000 --- a/studio/static/doc/flask-docs/deploying/index.html +++ /dev/null @@ -1,150 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>Deployment Options — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="next" title="mod_wsgi (Apache)" href="mod_wsgi.html" /> - <link rel="prev" title="Deferred Request Callbacks" href="../patterns/deferredcallbacks.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="mod_wsgi.html" title="mod_wsgi (Apache)" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="../patterns/deferredcallbacks.html" title="Deferred Request Callbacks" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="deployment-options"> -<span id="deployment"></span><h1>Deployment Options<a class="headerlink" href="#deployment-options" title="Permalink to this headline">¶</a></h1> -<p>Depending on what you have available there are multiple ways to run -Flask applications. You can use the builtin server during development, -but you should use a full deployment option for production applications. -(Do not use the builtin development server in production.) Several -options are available and documented here.</p> -<p>If you have a different WSGI server look up the server documentation -about how to use a WSGI app with it. Just remember that your -<tt class="xref py py-class docutils literal"><span class="pre">Flask</span></tt> application object is the actual WSGI application.</p> -<div class="toctree-wrapper compound"> -<ul> -<li class="toctree-l1"><a class="reference internal" href="mod_wsgi.html">mod_wsgi (Apache)</a><ul> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#installing-mod-wsgi">Installing <cite>mod_wsgi</cite></a></li> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#creating-a-wsgi-file">Creating a <cite>.wsgi</cite> file</a></li> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#configuring-apache">Configuring Apache</a></li> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#troubleshooting">Troubleshooting</a></li> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#support-for-automatic-reloading">Support for Automatic Reloading</a></li> -<li class="toctree-l2"><a class="reference internal" href="mod_wsgi.html#working-with-virtual-environments">Working with Virtual Environments</a></li> -</ul> -</li> -<li class="toctree-l1"><a class="reference internal" href="cgi.html">CGI</a><ul> -<li class="toctree-l2"><a class="reference internal" href="cgi.html#creating-a-cgi-file">Creating a <cite>.cgi</cite> file</a></li> -<li class="toctree-l2"><a class="reference internal" href="cgi.html#server-setup">Server Setup</a></li> -</ul> -</li> -<li class="toctree-l1"><a class="reference internal" href="fastcgi.html">FastCGI</a><ul> -<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#creating-a-fcgi-file">Creating a <cite>.fcgi</cite> file</a></li> -<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#configuring-lighttpd">Configuring lighttpd</a></li> -<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#configuring-nginx">Configuring nginx</a></li> -<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#running-fastcgi-processes">Running FastCGI Processes</a></li> -<li class="toctree-l2"><a class="reference internal" href="fastcgi.html#debugging">Debugging</a></li> -</ul> -</li> -<li class="toctree-l1"><a class="reference internal" href="uwsgi.html">uWSGI</a><ul> -<li class="toctree-l2"><a class="reference internal" href="uwsgi.html#starting-your-app-with-uwsgi">Starting your app with uwsgi</a></li> -<li class="toctree-l2"><a class="reference internal" href="uwsgi.html#configuring-nginx">Configuring nginx</a></li> -</ul> -</li> -<li class="toctree-l1"><a class="reference internal" href="others.html">Other Servers</a><ul> -<li class="toctree-l2"><a class="reference internal" href="others.html#tornado">Tornado</a></li> -<li class="toctree-l2"><a class="reference internal" href="others.html#gevent">Gevent</a></li> -<li class="toctree-l2"><a class="reference internal" href="others.html#gunicorn">Gunicorn</a></li> -<li class="toctree-l2"><a class="reference internal" href="others.html#proxy-setups">Proxy Setups</a></li> -</ul> -</li> -</ul> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p><h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li>Previous: <a href="../patterns/deferredcallbacks.html" title="previous chapter">Deferred Request Callbacks</a></li> - <li>Next: <a href="mod_wsgi.html" title="next chapter">mod_wsgi (Apache)</a></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/index.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file diff --git a/studio/static/doc/flask-docs/deploying/mod_wsgi.html b/studio/static/doc/flask-docs/deploying/mod_wsgi.html deleted file mode 100644 index a431756..0000000 --- a/studio/static/doc/flask-docs/deploying/mod_wsgi.html +++ /dev/null @@ -1,255 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>mod_wsgi (Apache) — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="up" title="Deployment Options" href="index.html" /> - <link rel="next" title="CGI" href="cgi.html" /> - <link rel="prev" title="Deployment Options" href="index.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="cgi.html" title="CGI" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="index.html" title="Deployment Options" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - <li><a href="index.html" accesskey="U">Deployment Options</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="mod-wsgi-apache"> -<span id="mod-wsgi-deployment"></span><h1>mod_wsgi (Apache)<a class="headerlink" href="#mod-wsgi-apache" title="Permalink to this headline">¶</a></h1> -<p>If you are using the <a class="reference external" href="http://httpd.apache.org/">Apache</a> webserver, consider using <a class="reference external" href="http://code.google.com/p/modwsgi/">mod_wsgi</a>.</p> -<div class="admonition-watch-out admonition "> -<p class="first admonition-title">Watch Out</p> -<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might -have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> -<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it’s -not called because this will always start a local WSGI server which -we do not want if we deploy that application to mod_wsgi.</p> -</div> -<div class="section" id="installing-mod-wsgi"> -<h2>Installing <cite>mod_wsgi</cite><a class="headerlink" href="#installing-mod-wsgi" title="Permalink to this headline">¶</a></h2> -<p>If you don’t have <cite>mod_wsgi</cite> installed yet you have to either install it -using a package manager or compile it yourself. The mod_wsgi -<a class="reference external" href="http://code.google.com/p/modwsgi/wiki/QuickInstallationGuide">installation instructions</a> cover source installations on UNIX systems.</p> -<p>If you are using Ubuntu/Debian you can apt-get it and activate it as -follows:</p> -<div class="highlight-text"><div class="highlight"><pre># apt-get install libapache2-mod-wsgi -</pre></div> -</div> -<p>On FreeBSD install <cite>mod_wsgi</cite> by compiling the <cite>www/mod_wsgi</cite> port or by -using pkg_add:</p> -<div class="highlight-text"><div class="highlight"><pre># pkg_add -r mod_wsgi -</pre></div> -</div> -<p>If you are using pkgsrc you can install <cite>mod_wsgi</cite> by compiling the -<cite>www/ap2-wsgi</cite> package.</p> -<p>If you encounter segfaulting child processes after the first apache -reload you can safely ignore them. Just restart the server.</p> -</div> -<div class="section" id="creating-a-wsgi-file"> -<h2>Creating a <cite>.wsgi</cite> file<a class="headerlink" href="#creating-a-wsgi-file" title="Permalink to this headline">¶</a></h2> -<p>To run your application you need a <cite>yourapplication.wsgi</cite> file. This file -contains the code <cite>mod_wsgi</cite> is executing on startup to get the application -object. The object called <cite>application</cite> in that file is then used as -application.</p> -<p>For most applications the following file should be sufficient:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> <span class="k">as</span> <span class="n">application</span> -</pre></div> -</div> -<p>If you don’t have a factory function for application creation but a singleton -instance you can directly import that one as <cite>application</cite>.</p> -<p>Store that file somewhere that you will find it again (e.g.: -<cite>/var/www/yourapplication</cite>) and make sure that <cite>yourapplication</cite> and all -the libraries that are in use are on the python load path. If you don’t -want to install it system wide consider using a <a class="reference external" href="http://pypi.python.org/pypi/virtualenv">virtual python</a> -instance.</p> -</div> -<div class="section" id="configuring-apache"> -<h2>Configuring Apache<a class="headerlink" href="#configuring-apache" title="Permalink to this headline">¶</a></h2> -<p>The last thing you have to do is to create an Apache configuration file -for your application. In this example we are telling <cite>mod_wsgi</cite> to -execute the application under a different user for security reasons:</p> -<div class="highlight-apache"><div class="highlight"><pre><span class="nt"><VirtualHost</span> <span class="s">*</span><span class="nt">></span> - <span class="nb">ServerName</span> example.com - - <span class="nb">WSGIDaemonProcess</span> yourapplication <span class="k">user</span>=user1 <span class="k">group</span>=group1 threads=5 - <span class="nb">WSGIScriptAlias</span> / <span class="sx">/var/www/yourapplication/yourapplication.wsgi</span> - - <span class="nt"><Directory</span> <span class="s">/var/www/yourapplication</span><span class="nt">></span> - <span class="nb">WSGIProcessGroup</span> yourapplication - <span class="nb">WSGIApplicationGroup</span> %{GLOBAL} - <span class="nb">Order</span> deny,allow - <span class="nb">Allow</span> from <span class="k">all</span> - <span class="nt"></Directory></span> -<span class="nt"></VirtualHost></span> -</pre></div> -</div> -<p>For more information consult the <a class="reference external" href="http://code.google.com/p/modwsgi/wiki/">mod_wsgi wiki</a>.</p> -</div> -<div class="section" id="troubleshooting"> -<h2>Troubleshooting<a class="headerlink" href="#troubleshooting" title="Permalink to this headline">¶</a></h2> -<p>If your application does not run, follow this guide to troubleshoot:</p> -<dl class="docutils"> -<dt><strong>Problem:</strong> application does not run, errorlog shows SystemExit ignored</dt> -<dd>You have a <tt class="docutils literal"><span class="pre">app.run()</span></tt> call in your application file that is not -guarded by an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> <span class="pre">'__main__':</span></tt> condition. Either -remove that <a class="reference internal" href="../api.html#flask.Flask.run" title="flask.Flask.run"><tt class="xref py py-meth docutils literal"><span class="pre">run()</span></tt></a> call from the file and move it -into a separate <cite>run.py</cite> file or put it into such an if block.</dd> -<dt><strong>Problem:</strong> application gives permission errors</dt> -<dd>Probably caused by your application running as the wrong user. Make -sure the folders the application needs access to have the proper -privileges set and the application runs as the correct user -(<tt class="docutils literal"><span class="pre">user</span></tt> and <tt class="docutils literal"><span class="pre">group</span></tt> parameter to the <cite>WSGIDaemonProcess</cite> -directive)</dd> -<dt><strong>Problem:</strong> application dies with an error on print</dt> -<dd><p class="first">Keep in mind that mod_wsgi disallows doing anything with -<a class="reference external" href="http://docs.python.org/dev/library/sys.html#sys.stdout" title="(in Python v3.3)"><tt class="xref py py-data docutils literal"><span class="pre">sys.stdout</span></tt></a> and <a class="reference external" href="http://docs.python.org/dev/library/sys.html#sys.stderr" title="(in Python v3.3)"><tt class="xref py py-data docutils literal"><span class="pre">sys.stderr</span></tt></a>. You can disable this -protection from the config by setting the <cite>WSGIRestrictStdout</cite> to -<tt class="docutils literal"><span class="pre">off</span></tt>:</p> -<div class="highlight-apache"><div class="highlight"><pre><span class="nb">WSGIRestrictStdout</span> <span class="k">Off</span> -</pre></div> -</div> -<p>Alternatively you can also replace the standard out in the .wsgi file -with a different stream:</p> -<div class="last highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">sys</span> -<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">stderr</span> -</pre></div> -</div> -</dd> -<dt><strong>Problem:</strong> accessing resources gives IO errors</dt> -<dd><p class="first">Your application probably is a single .py file you symlinked into -the site-packages folder. Please be aware that this does not work, -instead you either have to put the folder into the pythonpath the -file is stored in, or convert your application into a package.</p> -<p class="last">The reason for this is that for non-installed packages, the module -filename is used to locate the resources and for symlinks the wrong -filename is picked up.</p> -</dd> -</dl> -</div> -<div class="section" id="support-for-automatic-reloading"> -<h2>Support for Automatic Reloading<a class="headerlink" href="#support-for-automatic-reloading" title="Permalink to this headline">¶</a></h2> -<p>To help deployment tools you can activate support for automatic -reloading. Whenever something changes the <cite>.wsgi</cite> file, <cite>mod_wsgi</cite> will -reload all the daemon processes for us.</p> -<p>For that, just add the following directive to your <cite>Directory</cite> section:</p> -<div class="highlight-apache"><div class="highlight"><pre><span class="nb">WSGIScriptReloading</span> <span class="k">On</span> -</pre></div> -</div> -</div> -<div class="section" id="working-with-virtual-environments"> -<h2>Working with Virtual Environments<a class="headerlink" href="#working-with-virtual-environments" title="Permalink to this headline">¶</a></h2> -<p>Virtual environments have the advantage that they never install the -required dependencies system wide so you have a better control over what -is used where. If you want to use a virtual environment with mod_wsgi -you have to modify your <cite>.wsgi</cite> file slightly.</p> -<p>Add the following lines to the top of your <cite>.wsgi</cite> file:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="n">activate_this</span> <span class="o">=</span> <span class="s">'/path/to/env/bin/activate_this.py'</span> -<span class="nb">execfile</span><span class="p">(</span><span class="n">activate_this</span><span class="p">,</span> <span class="nb">dict</span><span class="p">(</span><span class="n">__file__</span><span class="o">=</span><span class="n">activate_this</span><span class="p">))</span> -</pre></div> -</div> -<p>This sets up the load paths according to the settings of the virtual -environment. Keep in mind that the path has to be absolute.</p> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">mod_wsgi (Apache)</a><ul> -<li><a class="reference internal" href="#installing-mod-wsgi">Installing <cite>mod_wsgi</cite></a></li> -<li><a class="reference internal" href="#creating-a-wsgi-file">Creating a <cite>.wsgi</cite> file</a></li> -<li><a class="reference internal" href="#configuring-apache">Configuring Apache</a></li> -<li><a class="reference internal" href="#troubleshooting">Troubleshooting</a></li> -<li><a class="reference internal" href="#support-for-automatic-reloading">Support for Automatic Reloading</a></li> -<li><a class="reference internal" href="#working-with-virtual-environments">Working with Virtual Environments</a></li> -</ul> -</li> -</ul> -<h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li><a href="index.html">Deployment Options</a><ul> - <li>Previous: <a href="index.html" title="previous chapter">Deployment Options</a></li> - <li>Next: <a href="cgi.html" title="next chapter">CGI</a></li> - </ul></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/mod_wsgi.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file diff --git a/studio/static/doc/flask-docs/deploying/others.html b/studio/static/doc/flask-docs/deploying/others.html deleted file mode 100644 index b1e545b..0000000 --- a/studio/static/doc/flask-docs/deploying/others.html +++ /dev/null @@ -1,200 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>Other Servers — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="up" title="Deployment Options" href="index.html" /> - <link rel="next" title="Becoming Big" href="../becomingbig.html" /> - <link rel="prev" title="uWSGI" href="uwsgi.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="../becomingbig.html" title="Becoming Big" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="uwsgi.html" title="uWSGI" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - <li><a href="index.html" accesskey="U">Deployment Options</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="other-servers"> -<span id="deploying-other-servers"></span><h1>Other Servers<a class="headerlink" href="#other-servers" title="Permalink to this headline">¶</a></h1> -<p>There are popular servers written in Python that allow the execution of WSGI -applications as well. These servers stand alone when they run; you can proxy -to them from your web server.</p> -<div class="section" id="tornado"> -<h2>Tornado<a class="headerlink" href="#tornado" title="Permalink to this headline">¶</a></h2> -<p><a class="reference external" href="http://www.tornadoweb.org/">Tornado</a> is an open source version of the scalable, non-blocking web -server and tools that power <a class="reference external" href="http://friendfeed.com/">FriendFeed</a>. Because it is non-blocking and -uses epoll, it can handle thousands of simultaneous standing connections, -which means it is ideal for real-time web services. Integrating this -service with Flask is a trivial task:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">tornado.wsgi</span> <span class="kn">import</span> <span class="n">WSGIContainer</span> -<span class="kn">from</span> <span class="nn">tornado.httpserver</span> <span class="kn">import</span> <span class="n">HTTPServer</span> -<span class="kn">from</span> <span class="nn">tornado.ioloop</span> <span class="kn">import</span> <span class="n">IOLoop</span> -<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> - -<span class="n">http_server</span> <span class="o">=</span> <span class="n">HTTPServer</span><span class="p">(</span><span class="n">WSGIContainer</span><span class="p">(</span><span class="n">app</span><span class="p">))</span> -<span class="n">http_server</span><span class="o">.</span><span class="n">listen</span><span class="p">(</span><span class="mi">5000</span><span class="p">)</span> -<span class="n">IOLoop</span><span class="o">.</span><span class="n">instance</span><span class="p">()</span><span class="o">.</span><span class="n">start</span><span class="p">()</span> -</pre></div> -</div> -</div> -<div class="section" id="gevent"> -<h2>Gevent<a class="headerlink" href="#gevent" title="Permalink to this headline">¶</a></h2> -<p><a class="reference external" href="http://www.gevent.org/">Gevent</a> is a coroutine-based Python networking library that uses -<a class="reference external" href="http://codespeak.net/py/0.9.2/greenlet.html">greenlet</a> to provide a high-level synchronous API on top of <a class="reference external" href="http://monkey.org/~provos/libevent/">libevent</a> -event loop:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">gevent.wsgi</span> <span class="kn">import</span> <span class="n">WSGIServer</span> -<span class="kn">from</span> <span class="nn">yourapplication</span> <span class="kn">import</span> <span class="n">app</span> - -<span class="n">http_server</span> <span class="o">=</span> <span class="n">WSGIServer</span><span class="p">((</span><span class="s">''</span><span class="p">,</span> <span class="mi">5000</span><span class="p">),</span> <span class="n">app</span><span class="p">)</span> -<span class="n">http_server</span><span class="o">.</span><span class="n">serve_forever</span><span class="p">()</span> -</pre></div> -</div> -</div> -<div class="section" id="gunicorn"> -<h2>Gunicorn<a class="headerlink" href="#gunicorn" title="Permalink to this headline">¶</a></h2> -<p><a class="reference external" href="http://gunicorn.org/">Gunicorn</a> ‘Green Unicorn’ is a WSGI HTTP Server for UNIX. It’s a pre-fork -worker model ported from Ruby’s Unicorn project. It supports both <a class="reference external" href="http://eventlet.net/">eventlet</a> -and <a class="reference external" href="http://codespeak.net/py/0.9.2/greenlet.html">greenlet</a>. Running a Flask application on this server is quite simple:</p> -<div class="highlight-python"><pre>gunicorn myproject:app</pre> -</div> -<p><a class="reference external" href="http://gunicorn.org/">Gunicorn</a> provides many command-line options – see <tt class="docutils literal"><span class="pre">gunicorn</span> <span class="pre">-h</span></tt>. -For example, to run a Flask application with 4 worker processes (<tt class="docutils literal"><span class="pre">-w</span> -<span class="pre">4</span></tt>) binding to localhost port 4000 (<tt class="docutils literal"><span class="pre">-b</span> <span class="pre">127.0.0.1:4000</span></tt>):</p> -<div class="highlight-python"><pre>gunicorn -w 4 -b 127.0.0.1:4000 myproject:app</pre> -</div> -</div> -<div class="section" id="proxy-setups"> -<h2>Proxy Setups<a class="headerlink" href="#proxy-setups" title="Permalink to this headline">¶</a></h2> -<p>If you deploy your application using one of these servers behind an HTTP -proxy you will need to rewrite a few headers in order for the -application to work. The two problematic values in the WSGI environment -usually are <cite>REMOTE_ADDR</cite> and <cite>HTTP_HOST</cite>. Werkzeug ships a fixer that -will solve some common setups, but you might want to write your own WSGI -middleware for specific setups.</p> -<p>The most common setup invokes the host being set from <cite>X-Forwarded-Host</cite> -and the remote address from <cite>X-Forwarded-For</cite>:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">werkzeug.contrib.fixers</span> <span class="kn">import</span> <span class="n">ProxyFix</span> -<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">ProxyFix</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span> -</pre></div> -</div> -<p>Please keep in mind that it is a security issue to use such a middleware -in a non-proxy setup because it will blindly trust the incoming -headers which might be forged by malicious clients.</p> -<p>If you want to rewrite the headers from another header, you might want to -use a fixer like this:</p> -<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">CustomProxyFix</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> - - <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">app</span><span class="p">):</span> - <span class="bp">self</span><span class="o">.</span><span class="n">app</span> <span class="o">=</span> <span class="n">app</span> - - <span class="k">def</span> <span class="nf">__call__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">):</span> - <span class="n">host</span> <span class="o">=</span> <span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'HTTP_X_FHOST'</span><span class="p">,</span> <span class="s">''</span><span class="p">)</span> - <span class="k">if</span> <span class="n">host</span><span class="p">:</span> - <span class="n">environ</span><span class="p">[</span><span class="s">'HTTP_HOST'</span><span class="p">]</span> <span class="o">=</span> <span class="n">host</span> - <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">app</span><span class="p">(</span><span class="n">environ</span><span class="p">,</span> <span class="n">start_response</span><span class="p">)</span> - -<span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span> <span class="o">=</span> <span class="n">CustomProxyFix</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">wsgi_app</span><span class="p">)</span> -</pre></div> -</div> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">Other Servers</a><ul> -<li><a class="reference internal" href="#tornado">Tornado</a></li> -<li><a class="reference internal" href="#gevent">Gevent</a></li> -<li><a class="reference internal" href="#gunicorn">Gunicorn</a></li> -<li><a class="reference internal" href="#proxy-setups">Proxy Setups</a></li> -</ul> -</li> -</ul> -<h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li><a href="index.html">Deployment Options</a><ul> - <li>Previous: <a href="uwsgi.html" title="previous chapter">uWSGI</a></li> - <li>Next: <a href="../becomingbig.html" title="next chapter">Becoming Big</a></li> - </ul></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/others.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file diff --git a/studio/static/doc/flask-docs/deploying/uwsgi.html b/studio/static/doc/flask-docs/deploying/uwsgi.html deleted file mode 100644 index 38eeed0..0000000 --- a/studio/static/doc/flask-docs/deploying/uwsgi.html +++ /dev/null @@ -1,167 +0,0 @@ - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - - -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - - <title>uWSGI — Flask 0.8 documentation</title> - - <link rel="stylesheet" href="../_static/flasky.css" type="text/css" /> - <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> - - <script type="text/javascript"> - var DOCUMENTATION_OPTIONS = { - URL_ROOT: '../', - VERSION: '0.8', - COLLAPSE_INDEX: false, - FILE_SUFFIX: '.html', - HAS_SOURCE: true - }; - </script> - <script type="text/javascript" src="../_static/jquery.js"></script> - <script type="text/javascript" src="../_static/underscore.js"></script> - <script type="text/javascript" src="../_static/doctools.js"></script> - <link rel="top" title="Flask 0.8 documentation" href="../index.html" /> - <link rel="up" title="Deployment Options" href="index.html" /> - <link rel="next" title="Other Servers" href="others.html" /> - <link rel="prev" title="FastCGI" href="fastcgi.html" /> - - - <link rel="apple-touch-icon" href="../_static/touch-icon.png" /> - - <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" /> - - </head> - <body> - <div class="related"> - <h3>Navigation</h3> - <ul> - <li class="right" style="margin-right: 10px"> - <a href="../genindex.html" title="General Index" - accesskey="I">index</a></li> - <li class="right" > - <a href="others.html" title="Other Servers" - accesskey="N">next</a> |</li> - <li class="right" > - <a href="fastcgi.html" title="FastCGI" - accesskey="P">previous</a> |</li> - <li><a href="../index.html">Flask 0.8 documentation</a> »</li> - <li><a href="index.html" accesskey="U">Deployment Options</a> »</li> - </ul> - </div> - - <div class="document"> - <div class="documentwrapper"> - <div class="bodywrapper"> - <div class="body"> - - <div class="section" id="uwsgi"> -<span id="deploying-uwsgi"></span><h1>uWSGI<a class="headerlink" href="#uwsgi" title="Permalink to this headline">¶</a></h1> -<p>uWSGI is a deployment option on servers like <a class="reference external" href="http://nginx.org/">nginx</a>, <a class="reference external" href="http://www.lighttpd.net/">lighttpd</a>, and -<a class="reference external" href="http://www.cherokee-project.com/">cherokee</a>; see <a class="reference internal" href="fastcgi.html#deploying-fastcgi"><em>FastCGI</em></a> and -<a class="reference internal" href="others.html#deploying-other-servers"><em>Other Servers</em></a> for other options. To use your WSGI -application with uWSGI protocol you will need a uWSGI server -first. uWSGI is both a protocol and an application server; the -application server can serve uWSGI, FastCGI, and HTTP protocols.</p> -<p>The most popular uWSGI server is <a class="reference external" href="http://projects.unbit.it/uwsgi/">uwsgi</a>, which we will use for this -guide. Make sure to have it installed to follow along.</p> -<div class="admonition-watch-out admonition "> -<p class="first admonition-title">Watch Out</p> -<p class="last">Please make sure in advance that any <tt class="docutils literal"><span class="pre">app.run()</span></tt> calls you might -have in your application file are inside an <tt class="docutils literal"><span class="pre">if</span> <span class="pre">__name__</span> <span class="pre">==</span> -<span class="pre">'__main__':</span></tt> block or moved to a separate file. Just make sure it’s -not called because this will always start a local WSGI server which -we do not want if we deploy that application to uWSGI.</p> -</div> -<div class="section" id="starting-your-app-with-uwsgi"> -<h2>Starting your app with uwsgi<a class="headerlink" href="#starting-your-app-with-uwsgi" title="Permalink to this headline">¶</a></h2> -<p><cite>uwsgi</cite> is designed to operate on WSGI callables found in python modules.</p> -<p>Given a flask application in myapp.py, use the following command:</p> -<div class="highlight-text"><div class="highlight"><pre>$ uwsgi -s /tmp/uwsgi.sock --module myapp --callable app -</pre></div> -</div> -<p>Or, if you prefer:</p> -<div class="highlight-text"><div class="highlight"><pre>$ uwsgi -s /tmp/uwsgi.sock -w myapp:app -</pre></div> -</div> -</div> -<div class="section" id="configuring-nginx"> -<h2>Configuring nginx<a class="headerlink" href="#configuring-nginx" title="Permalink to this headline">¶</a></h2> -<p>A basic flask uWSGI configuration for nginx looks like this:</p> -<div class="highlight-python"><pre>location = /yourapplication { rewrite ^ /yourapplication/; } -location /yourapplication { try_files $uri @yourapplication; } -location @yourapplication { - include uwsgi_params; - uwsgi_param SCRIPT_NAME /yourapplication; - uwsgi_modifier1 30; - uwsgi_pass unix:/tmp/uwsgi.sock; -}</pre> -</div> -<p>This configuration binds the application to <cite>/yourapplication</cite>. If you want -to have it in the URL root it’s a bit simpler because you don’t have to tell -it the WSGI <cite>SCRIPT_NAME</cite> or set the uwsgi modifier to make use of it:</p> -<div class="highlight-python"><pre>location / { try_files $uri @yourapplication; } -location @yourapplication { - include uwsgi_params; - uwsgi_pass unix:/tmp/uwsgi.sock; -}</pre> -</div> -</div> -</div> - - - </div> - </div> - </div> - <div class="sphinxsidebar"> - <div class="sphinxsidebarwrapper"><p class="logo"><a href="../index.html"> - <img class="logo" src="../_static/flask.png" alt="Logo"/> -</a></p> - <h3><a href="../index.html">Table Of Contents</a></h3> - <ul> -<li><a class="reference internal" href="#">uWSGI</a><ul> -<li><a class="reference internal" href="#starting-your-app-with-uwsgi">Starting your app with uwsgi</a></li> -<li><a class="reference internal" href="#configuring-nginx">Configuring nginx</a></li> -</ul> -</li> -</ul> -<h3>Related Topics</h3> -<ul> - <li><a href="../index.html">Documentation overview</a><ul> - <li><a href="index.html">Deployment Options</a><ul> - <li>Previous: <a href="fastcgi.html" title="previous chapter">FastCGI</a></li> - <li>Next: <a href="others.html" title="next chapter">Other Servers</a></li> - </ul></li> - </ul></li> -</ul> - <h3>This Page</h3> - <ul class="this-page-menu"> - <li><a href="../_sources/deploying/uwsgi.txt" - rel="nofollow">Show Source</a></li> - </ul> -<div id="searchbox" style="display: none"> - <h3>Quick search</h3> - <form class="search" action="../search.html" method="get"> - <input type="text" name="q" /> - <input type="submit" value="Go" /> - <input type="hidden" name="check_keywords" value="yes" /> - <input type="hidden" name="area" value="default" /> - </form> - <p class="searchtip" style="font-size: 90%"> - Enter search terms or a module, class or function name. - </p> -</div> -<script type="text/javascript">$('#searchbox').show(0);</script> - </div> - </div> - <div class="clearer"></div> - </div> - <div class="footer"> - © Copyright 2010, Armin Ronacher. - Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>. - </div> - </body> -</html>
\ No newline at end of file |