src/source/appinstall.rst
branchdoc-dc
changeset 55 949d496c4e96
parent 51 5ebe61e3a965
child 57 e7d62e94392f
equal deleted inserted replaced
54:e3d33ef363fd 55:949d496c4e96
   227 
   227 
   228 
   228 
   229 .. _zodbinit:
   229 .. _zodbinit:
   230 
   230 
   231 Initializing the ZODB database
   231 Initializing the ZODB database
   232 ==============================
   232 ------------------------------
   233 
   233 
   234 After, you have downloaded and installed all required packages, you have to initialize the database so that all
   234 After, you have downloaded and installed all required packages, you have to initialize the database so that all
   235 required components are available.
   235 required components are available.
   236 
   236 
   237 From a shell, just type:
   237 From a shell, just type:
   242 
   242 
   243 This process requires that every package is correctly included into *pyramid.includes* directive from selected
   243 This process requires that every package is correctly included into *pyramid.includes* directive from selected
   244 configuration file.
   244 configuration file.
   245 
   245 
   246 
   246 
   247 Initializing Elasticsearch index
   247 
   248 ================================
   248 
   249 
       
   250 If you want to use an Elasticsearch index, you have to initialize index settings and mappings; the Ingest attachment
       
   251 plug-in is also required to handle attachments correctly.
       
   252 
       
   253 Elasticsearch integration is defined through the *PyAMS_content_es* package. Configuration files are available in this
       
   254 package, for attachment pipeline, index settings and mappings:
       
   255 
       
   256 .. code-block:: bash
       
   257 
       
   258     (env) $ cd /var/local/src/pyams/pyams_content_es
       
   259     (env) $ curl --noproxy localhost -XDELETE http://localhost:9200/pyams (1)
       
   260     (env) $ curl --noproxy localhost -XPUT    http://localhost:9200/pyams -d @index-settings.json
       
   261 
       
   262     (env) $ curl --noproxy localhost -XPUT    http://localhost:9200/pyams/WfNewsEvent/_mapping -d @mappings/WfNewsEvent.json
       
   263     (env) $ curl --noproxy localhost -XPUT    http://localhost:9200/pyams/WfTopic/_mapping -d @mappings/WfTopic.json
       
   264     (env) $ curl --noproxy localhost -XPUT    http://localhost:9200/pyams/WfBlogPost/_mapping -d @mappings/WfBlogPost.json
       
   265 
       
   266 (1) If 'pyams' is defined as Elasticsearch index name.
       
   267 
       
   268 
       
   269 Initializing NLTK
       
   270 =================
       
   271 
       
   272 Some NLTK (Natural Language Toolkit) tokenizers and stopwords utilities are used to index fulltext contents elements.
       
   273 This package requires downloading and configuration of several elements which are done as follow:
       
   274 
       
   275 .. code-block:: bash
       
   276 
       
   277     (end) $ ./bin/py
       
   278     >>> import nltk
       
   279     >>> nltk.download()
       
   280     NLTK Downloader
       
   281     ---------------------------------------------------------------------------
       
   282         d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
       
   283     ---------------------------------------------------------------------------
       
   284     Downloader> c
       
   285 
       
   286     Data Server:
       
   287       - URL: <https://raw.githubusercontent.com/nltk/nltk_data/gh-pages/index.xml>
       
   288       - 6 Package Collections Available
       
   289       - 107 Individual Packages Available
       
   290 
       
   291     Local Machine:
       
   292       - Data directory: /home/tflorac/nltk_data
       
   293 
       
   294     ---------------------------------------------------------------------------
       
   295         s) Show Config   u) Set Server URL   d) Set Data Dir   m) Main Menu
       
   296     ---------------------------------------------------------------------------
       
   297     Config> d
       
   298       New directory> /usr/local/lib/nltk_data (1)
       
   299     Config> m
       
   300 
       
   301     ---------------------------------------------------------------------------
       
   302         d) Download   l) List    u) Update   c) Config   h) Help   q) Quit
       
   303     ---------------------------------------------------------------------------
       
   304     Downloader> d
       
   305 
       
   306     Download which package (l=list; x=cancel)?
       
   307       Identifier> punkt
       
   308         Downloading package punkt to /usr/local/lib/nltk_data...
       
   309 
       
   310     Downloader> d
       
   311 
       
   312     Download which package (l=list; x=cancel)?
       
   313       Identifier> stopwords
       
   314         Downloading package stopwords to /usr/local/lib/nltk_data...
       
   315 
       
   316 
       
   317 (1) On Debian GNU/Linux, you can choose any directory between '*~/nltk_data*' (where '~' is the homedir of user running
       
   318 Pyramid application), '*/usr/share/nltk_data*', '*/usr/local/share/nltk_data*', '*/usr/lib/nltk_data*' and
       
   319 '*/usr/local/lib/nltk_data*'.
       
   320 
       
   321