The DicoTopo application API
This repository contains the API service code for https://dicotopo.cths.fr.
ℹ️ Below commands are run independently/outside virtual environments (deactivate
)
- Elasticsearch: refer to your organisation instructions or Elasticsearch guidelines
- ICU plugin: check if ICU is installed with
uconv -V
, otherwise:path/to/elasticsearch_folder/bin/elasticsearch-plugin install analysis-icu
Local deployment
With docker (security disabled):
docker run --name es-project_name -d -p 9200:9200 -e "discovery.type=single-node" -e "xpack.security.enabled=false" -e "xpack.security.http.ssl.enabled=false" elasticsearch:8.12.1
docker exec es-project_name bash -c "bin/elasticsearch-plugin install analysis-icu"
docker restart es-project_name
- Clone the GitHub repository in your projects folder:
cd path/to/projects_folder/ git clone https://github.com/chartes/encpos-app.git
- Clone the GitHub repository in your projects folder:
cd path/to/projects_folder/
git clone https://github.com/chartes/encpos-app.git
-
Set up the virtual environment in the app folder:
cd path/to/projects_folder/encpos-app python3 -m venv venv source venv/bin/activate pip3 install -r requirements.txt
For servers requiring uWSGI to run Python apps (remote Nginx servers):
- check if uWSGI is installed
pip3 list --local
- install it in the virtual env if it's not:
pip3 install uWSGI
.
NB : cette commande peut nécessiter d'installer wheel :
- pour vérifier si wheel est installé :
pip3 show wheel
- pour l'installer le cas échéant :
pip3 install wheel
- check if uWSGI is installed
-
Install Elasticsearch and create indices if they are not available:
Follow the ES installation & initial indexing instructions below
- Start the server in debug mode:
python flask_app.py
- Then visit http://127.0.0.1:5003/dico-topo/api/1.0?capabilities to get infos about the API capabilities
more info about the configuration of ES: https://jolicode.com/blog/construire-un-bon-analyzer-francais-pour-elasticsearch
How to reindex all indexable data, referencing a localhost api:
python manage.py db-reindex --host=http://localhost --delete=1