docs/build/html/install.html
changeset 79 e12e18e99a68
parent 78 54aeb42c0d80
child 80 137705383aaf
equal deleted inserted replaced
78:54aeb42c0d80 79:e12e18e99a68
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       
     2   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
       
     3 
       
     4 
       
     5 <html xmlns="http://www.w3.org/1999/xhtml">
       
     6   <head>
       
     7     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
       
     8     
       
     9     <title>Installing PyAMS &#8212; PyAMS_utils 0.1.4 documentation</title>
       
    10     
       
    11     <link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
       
    12     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
       
    13     
       
    14     <script type="text/javascript">
       
    15       var DOCUMENTATION_OPTIONS = {
       
    16         URL_ROOT:    './',
       
    17         VERSION:     '0.1.4',
       
    18         COLLAPSE_INDEX: false,
       
    19         FILE_SUFFIX: '.html',
       
    20         HAS_SOURCE:  true
       
    21       };
       
    22     </script>
       
    23     <script type="text/javascript" src="_static/jquery.js"></script>
       
    24     <script type="text/javascript" src="_static/underscore.js"></script>
       
    25     <script type="text/javascript" src="_static/doctools.js"></script>
       
    26     <link rel="index" title="Index" href="genindex.html" />
       
    27     <link rel="search" title="Search" href="search.html" />
       
    28     <link rel="top" title="PyAMS_utils 0.1.4 documentation" href="index.html" />
       
    29     <link rel="next" title="Managing ZCA with PyAMS" href="zca.html" />
       
    30     <link rel="prev" title="Welcome to PyAMS_utils’s documentation!" href="index.html" />
       
    31 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
       
    32 <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
       
    33 <!--[if lte IE 6]>
       
    34 <link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
       
    35 <![endif]-->
       
    36 
       
    37   </head>
       
    38   <body role="document">
       
    39 
       
    40     <div class="related" role="navigation" aria-label="related navigation">
       
    41       <h3>Navigation</h3>
       
    42       <ul>
       
    43         <li class="right" style="margin-right: 10px">
       
    44           <a href="genindex.html" title="General Index"
       
    45              accesskey="I">index</a></li>
       
    46         <li class="right" >
       
    47           <a href="py-modindex.html" title="Python Module Index"
       
    48              >modules</a> |</li>
       
    49         <li class="right" >
       
    50           <a href="zca.html" title="Managing ZCA with PyAMS"
       
    51              accesskey="N">next</a> |</li>
       
    52         <li class="right" >
       
    53           <a href="index.html" title="Welcome to PyAMS_utils’s documentation!"
       
    54              accesskey="P">previous</a> |</li>
       
    55         <li class="nav-item nav-item-0"><a href="index.html">PyAMS_utils 0.1.4 documentation</a> &#187;</li> 
       
    56       </ul>
       
    57     </div>  
       
    58 
       
    59     <div class="document">
       
    60       <div class="documentwrapper">
       
    61         <div class="bodywrapper">
       
    62           <div class="body" role="main">
       
    63             
       
    64   <div class="section" id="installing-pyams">
       
    65 <span id="install"></span><h1>Installing PyAMS<a class="headerlink" href="#installing-pyams" title="Permalink to this headline">¶</a></h1>
       
    66 <p>PyAMS default installation is based on <a class="reference external" href="http://www.buildout.org">Buildout</a> utility. It&#8217;s not mandatory to use a
       
    67 virtual environment, but it allows you to have a better control over your Python resources.</p>
       
    68 <p>Current PyAMS version is based and validated for Python 3.4; your Python environment must also include a C
       
    69 compiler as well as development headers for Python, <em>libjpeg</em>, <em>libpng</em>, <em>libfreetype</em>, <em>libxml2</em>, <em>libxslt</em> and
       
    70 eventually <em>libldap</em> or <em>libzmq</em>.</p>
       
    71 <p>PyAMS default components configuration also pre-suppose that the following external tools are available:</p>
       
    72 <ul class="simple">
       
    73 <li>a <em>memcached</em> server, to store sessions and cache (can be changed through Beaker configuration)</li>
       
    74 </ul>
       
    75 <p>Optional tools also include:</p>
       
    76 <ul class="simple">
       
    77 <li>an <em>ElasticSearch</em> server for full text indexing (see <em>PyAMS_content_es</em> package)</li>
       
    78 <li>a <em>WebSockets</em> server using async IO. This is used to manage notifications (see <em>PyAMS_notify</em> and <em>PyAMS_notify_ws</em>
       
    79 packages). An <em>out of the box</em> environment can be built using <em>pyams_asyncio</em> scaffold provided by <em>pyams_base</em>
       
    80 package.</li>
       
    81 </ul>
       
    82 <p>You can also choose to use a local ZODB instance, or a ZEO server (which can be local or remote, but is required if
       
    83 you want to use PyAMS in a muti-processes configuration).</p>
       
    84 <div class="section" id="creating-initial-buildout">
       
    85 <h2>Creating initial buildout<a class="headerlink" href="#creating-initial-buildout" title="Permalink to this headline">¶</a></h2>
       
    86 <p>PyAMS provides a new Pyramid scaffold, called <em>pyams</em>, provided by the <em>pyams_base</em> package.</p>
       
    87 <p>A simple option to install PyAMS is to create a buildout environment including <em>Pyramid</em> and <em>PyAMS_base</em> packages:</p>
       
    88 <div class="highlight-bash"><div class="highlight"><pre><span class="c"># mkdir /var/local/env/</span>
       
    89 <span class="c"># pip3 install virtualenv</span>
       
    90 <span class="c"># virtualenv --python=python3.4 pyams</span>
       
    91 <span class="c"># cd pyams</span>
       
    92 <span class="c"># . bin/activate</span>
       
    93 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># pip3.4 install zc.buildout</span>
       
    94 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># buildout init</span>
       
    95 </pre></div>
       
    96 </div>
       
    97 <p>Then update your Buildout configuration file <em>buildout.cfg</em> as follow:</p>
       
    98 <div class="highlight-ini"><div class="highlight"><pre><span class="k">[buildout]</span>
       
    99 <span class="na">find-links</span> <span class="o">=</span> <span class="s">http://download.ztfy.org/eggs</span>
       
   100 <span class="na">extends</span> <span class="o">=</span> <span class="s">http://download.ztfy.org/pyams/pyams-0.1.0.cfg</span>
       
   101 <span class="na">socket-timeout</span> <span class="o">=</span> <span class="s">3</span>
       
   102 <span class="na">show-picked-versions</span> <span class="o">=</span> <span class="s">true</span>
       
   103 <span class="na">newest</span> <span class="o">=</span> <span class="s">false</span>
       
   104 <span class="na">allow-hosts</span> <span class="o">=</span><span class="s"></span>
       
   105 <span class="s">    *.python.org</span>
       
   106 <span class="s">    *.sourceforge.net</span>
       
   107 <span class="s">    github.com</span>
       
   108 <span class="s">    bitbucket.org</span>
       
   109 <span class="na">versions</span> <span class="o">=</span> <span class="s">versions</span>
       
   110 <span class="na">eggs-directory</span> <span class="o">=</span> <span class="s">eggs</span>
       
   111 <span class="na">parts</span> <span class="o">=</span> <span class="s">pyramid</span>
       
   112 
       
   113 <span class="k">[pyramid]</span>
       
   114 <span class="na">recipe</span> <span class="o">=</span> <span class="s">zc.recipe.egg</span>
       
   115 <span class="na">dependent-scripts</span> <span class="o">=</span> <span class="s">true</span>
       
   116 <span class="na">eggs</span> <span class="o">=</span><span class="s"></span>
       
   117 <span class="s">    pyramid</span>
       
   118 <span class="s">    pyams_base</span>
       
   119 <span class="na">interpreter</span> <span class="o">=</span> <span class="s">py3.4</span>
       
   120 </pre></div>
       
   121 </div>
       
   122 <p>Then launch the buildout initialization:</p>
       
   123 <div class="highlight-bash"><div class="highlight"><pre><span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ./bin/buildout</span>
       
   124 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ./bin/pcreate -l</span>
       
   125 Available scaffolds:
       
   126   alchemy:  Pyramid project using SQLAlchemy, SQLite, URL dispatch, and
       
   127   pyams:    Pyramid project using all PyAMS packages
       
   128   starter:  Pyramid starter project using URL dispatch and Chameleon
       
   129   zodb:     Pyramid project using ZODB, traversal, and Chameleon
       
   130 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ./bin/pcreate -t pyams myapp</span>
       
   131 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># cd myapp</span>
       
   132 </pre></div>
       
   133 </div>
       
   134 <p>You can then check, and eventually update, the proposed Buildout configuration file <em>buildout.cfg</em>, to add or remove
       
   135 packages or update settings to your needs. Then finalize Bootstrap initialization:</p>
       
   136 <div class="highlight-bash"><div class="highlight"><pre><span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ../bin/buildout bootstrap</span>
       
   137 <span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ./bin/buildout</span>
       
   138 </pre></div>
       
   139 </div>
       
   140 <p>This last operation can be quite long, as many packages have to downloaded, compiled and installed in the virtual
       
   141 environment. If you encounter any compile error, just install the required dependencies and restart the buildout.</p>
       
   142 </div>
       
   143 <div class="section" id="environment-settings">
       
   144 <h2>Environment settings<a class="headerlink" href="#environment-settings" title="Permalink to this headline">¶</a></h2>
       
   145 <p>The project generated from <em>pyams</em> scaffold is based on default Pyramid&#8217;s <em>zodb</em> scaffold, but it adds:</p>
       
   146 <ul class="simple">
       
   147 <li>a custom application factory, in the <em>webapp</em> directory (see <a class="reference internal" href="site.html#site"><span class="std std-ref">PyAMS site management</span></a>)</li>
       
   148 <li>a set of directories to store runtime data, in the <em>var</em> directory; each directory contains a <em>README.txt</em> file
       
   149 which should be self-explanatory to indicate what this directory should contain, including a ZODB or a ZEO cache</li>
       
   150 <li>a set of configuration files, in the <em>etc</em> directory; here are standard <em>development.ini</em> and <em>production.ini</em>
       
   151 configuration files, two ZODB configuration files (<em>zodb.conf.fs</em> for a single FileStorage application process, and
       
   152 <em>zodb.conf.zeo</em> for a ZEO client storage; default configuration defined in INI files is based on a single file
       
   153 storage) and two Apache configurations (for Apache 2.2 and 2.4) using <em>mod_wsgi</em>.</li>
       
   154 </ul>
       
   155 <p>Once the project have been created from the scaffold, you are free to update all the configuration files.</p>
       
   156 <p>If you need to add packages to the environment, you have to add them to the <em>buildout.cfg</em> file <strong>AND</strong> to the INI
       
   157 file (in the <em>pyramid.includes</em> section) before running the <em>buildout</em> another time; don&#8217;t forget to add the
       
   158 requested version at the end of <em>buildout.cfg</em> file, as Buildout is not configured by default to automatically
       
   159 download the last release of a given unknown package.</p>
       
   160 <p><em>development.ini</em> and <em>production.ini</em> files contain many commented directives related to PyAMS components. Read and
       
   161 update them carefully before initializing your application database!</p>
       
   162 </div>
       
   163 <div class="section" id="initializing-the-database">
       
   164 <h2>Initializing the database<a class="headerlink" href="#initializing-the-database" title="Permalink to this headline">¶</a></h2>
       
   165 <p>When you have downloaded and installed all required packages, you have to initialize the database so that all
       
   166 required components are available.</p>
       
   167 <p>From a shell, just type:</p>
       
   168 <div class="highlight-bash"><div class="highlight"><pre><span class="o">(</span>pyams<span class="o">)</span> <span class="c"># ./bin/pyams_upgrade etc/development.ini</span>
       
   169 </pre></div>
       
   170 </div>
       
   171 <p>This process requires that every package is correctly included into <em>pyramid.includes</em> directive from selected
       
   172 configuration file.</p>
       
   173 </div>
       
   174 </div>
       
   175 
       
   176 
       
   177           </div>
       
   178         </div>
       
   179       </div>
       
   180       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
       
   181         <div class="sphinxsidebarwrapper">
       
   182   <h3><a href="index.html">Table Of Contents</a></h3>
       
   183   <ul>
       
   184 <li><a class="reference internal" href="#">Installing PyAMS</a><ul>
       
   185 <li><a class="reference internal" href="#creating-initial-buildout">Creating initial buildout</a></li>
       
   186 <li><a class="reference internal" href="#environment-settings">Environment settings</a></li>
       
   187 <li><a class="reference internal" href="#initializing-the-database">Initializing the database</a></li>
       
   188 </ul>
       
   189 </li>
       
   190 </ul>
       
   191 
       
   192   <h4>Previous topic</h4>
       
   193   <p class="topless"><a href="index.html"
       
   194                         title="previous chapter">Welcome to PyAMS_utils&#8217;s documentation!</a></p>
       
   195   <h4>Next topic</h4>
       
   196   <p class="topless"><a href="zca.html"
       
   197                         title="next chapter">Managing ZCA with PyAMS</a></p>
       
   198 <div id="searchbox" style="display: none" role="search">
       
   199   <h3>Quick search</h3>
       
   200     <form class="search" action="search.html" method="get">
       
   201       <div><input type="text" name="q" /></div>
       
   202       <div><input type="submit" value="Go" /></div>
       
   203       <input type="hidden" name="check_keywords" value="yes" />
       
   204       <input type="hidden" name="area" value="default" />
       
   205     </form>
       
   206 </div>
       
   207 <script type="text/javascript">$('#searchbox').show(0);</script>
       
   208         </div>
       
   209       </div>
       
   210       <div class="clearer"></div>
       
   211     </div>
       
   212     <div class="related" role="navigation" aria-label="related navigation">
       
   213       <h3>Navigation</h3>
       
   214       <ul>
       
   215         <li class="right" style="margin-right: 10px">
       
   216           <a href="genindex.html" title="General Index"
       
   217              >index</a></li>
       
   218         <li class="right" >
       
   219           <a href="py-modindex.html" title="Python Module Index"
       
   220              >modules</a> |</li>
       
   221         <li class="right" >
       
   222           <a href="zca.html" title="Managing ZCA with PyAMS"
       
   223              >next</a> |</li>
       
   224         <li class="right" >
       
   225           <a href="index.html" title="Welcome to PyAMS_utils’s documentation!"
       
   226              >previous</a> |</li>
       
   227         <li class="nav-item nav-item-0"><a href="index.html">PyAMS_utils 0.1.4 documentation</a> &#187;</li> 
       
   228       </ul>
       
   229     </div>
       
   230     <div class="footer" role="contentinfo">
       
   231         &#169; Copyright 2016, Thierry Florac &lt;tflorac@ulthar.net&gt;.
       
   232       Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.8.
       
   233     </div>
       
   234   </body>
       
   235 </html>