<commit_before>Setup
=====

1. Install Python >= 2.6 and virtualenv; activate the virtualenv.

2. Install dependencies::

    pip install -r requirements-dev.txt

3. Create a local data directory, make sure it's not committed to the
   repository by mistake. We'll call it ``$DATA``.

4. Optionally create a local configuration file::

    echo "STORAGE_ENGINE = 'solr'" > $DATA/config.py

5. Run the server::

    APP_SETTINGS=$DATA/config.py python rio.py runserver

6. Optionally create a script in __venv__/bin/rio to simplify the above
   command (__venv__ stands for the path to the virtualenv folder).
   Don't forget to make it executable (``chmod +x __venv__/bin/rio``)::

    #!/bin/bash
    PRJ='__venv__'
    export APP_SETTINGS=$PRJ/data/config.py
    exec $PRJ/sandbox/bin/python $PRJ/rio.py $@

   Run the script as ``rio runserver``.


Loading data from Access database
=================================

1. Set up solr config (TODO)
   Note: the Solr configuration file needs to have these lines::

    <solrQueryParser defaultOperator="AND"/>

    <field name="regcod" type="string" indexed="true" stored="true" multiValued="true"/><commit_msg>documentation to get zope running<commit_after>Setup
=====

1. Install Python >= 2.6 and virtualenv; activate the virtualenv.

2. Install dependencies::

    pip install -r requirements-dev.txt

3. Create a local data directory, make sure it's not committed to the
   repository by mistake. We'll call it ``$DATA``.

4. Optionally create a local configuration file::

    echo "STORAGE_ENGINE = 'solr'" > $DATA/config.py

5. Run the server::

    APP_SETTINGS=$DATA/config.py python rio.py runserver

6. Optionally create a script in __venv__/bin/rio to simplify the above
   command (__venv__ stands for the path to the virtualenv folder).
   Don't forget to make it executable (``chmod +x __venv__/bin/rio``)::

    #!/bin/bash
    PRJ='__venv__'
    export APP_SETTINGS=$PRJ/data/config.py
    exec $PRJ/sandbox/bin/python $PRJ/rio.py $@

   Run the script as ``rio runserver``.


Setup of a CHM3 portal
======================

A minimal buildout is provided in the ``buildout`` folder. It's mostly
self-contained except for the ``NaayaBundles-CHMEU`` package and the
database file.

Get the ``NaayaBundles-CHMEU`` package::

    mkdir buildout/src
    cd buildout/src
    svn co https://svn.eionet.europa.eu/repositories/Naaya/trunk/eggs/NaayaBundles-CHMEU

In the ``buildout`` directory, bootstrap and run the buildout::

    cp buildout-example.cfg buildout.cfg
    python2.4 bootstrap.py -d
    bin/buildout


Finally, copy the database file (``Data.fs``) to ``var/filestorage/``.

To run the application with Zope, first start Solr, then the `rio.py`
server, and then zope (by running ``bin/zope-instance fg`` from within
the ``buildout`` directory). The application should be accessible at
``http://localhost:8080/chm_ro/rio/natura2000/``.


Loading data from Access database
=================================

1. Set up solr config (TODO)
   Note: the Solr configuration file needs to have these lines::

    <solrQueryParser defaultOperator="AND"/>

    <field name="regcod" type="string" indexed="true" stored="true" multiValued="true"/>
{'fraction_non_alphanumeric': 0.1348489567113049, 'fraction_numerical': 0.00903145437558393, 'mean_word_length': 3.964451313755796, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3648460', 'n_tokens_mistral': 1048, 'n_tokens_neox': 985, 'n_words': 352}