Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ languages.

### Example: [Tsunkua Corpus Paralelo Español-Otomí](https://tsunkua.elotl.mx/)

<p align="center">
<img src="https://elotl.mx/wp-content/uploads/2020/07/tsunkua.png" width="40%" height="40%" />
<img src="https://elotl.mx/wp-content/uploads/2020/07/export_csv.png" width="52%" height="52%" />
<p aling="center">
<img src="docs/source/static/img/tsunkua.png" width=50% />
<img src="docs/source/static/img/export_csv.png" width=45% />
</p>

## Docs
Expand All @@ -39,26 +39,25 @@ structure you can check our [documentation](https://esquite.readthedocs.io/es/la

## Dependencies

* [Elasticsearch 8.15](www.elastic.co/guide/en/elasticsearch/reference/8.15/elasticsearch-intro-what-is-es.html)
* `python 3.12` or higher
* `uv`
* `git`
* [Elasticsearch 7.6](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/getting-started-install.html) or higher
* `python 3.7` or higher
* `poetry`

## Installation

1. Install and run `elasticsearch`

**Note**: Check the official page of
[Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html)
to complete this step depending on your OS. Alternatively you can use
[docker](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html) for easier installation.
> [!NOTE]
> Check the official page of [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/install-elasticsearch.html) to complete this step depending on your OS. Alternatively you can use [docker](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/docker.html) for easier installation.

> [!TIP]
> Maybe you would want to disable elasticsearch default security features if you are running it in your local network or if you are just playing with esquite. You can modify the file in `/usr/share/elasticsearch/config/elasticsearch.yaml`.

2. [Install](https://github.com/python-poetry/poetry#installation) `poetry` in
your system
2. [Install](https://docs.astral.sh/uv/#installation) `uv` in your system

```shell
$ curl -sSL https://install.python-poetry.org | python3 -
$ curl -LsSf https://astral.sh/uv/install.sh | sh
```

3. Clone this repo
Expand All @@ -74,40 +73,42 @@ structure you can check our [documentation](https://esquite.readthedocs.io/es/la

```shell
$ cd Esquite
$ poetry install --no-dev --no root
$ poetry shell
$ uv sync --no-dev
$ source .venv/bin/activate
```

5. Launch the installation wizard and type the information requested

```shell
(env)$ python wizard.py
(esquite)$ python wizard.py
```

**Note**: The wizard automatically create an `elasticsearch` index.
Alternatively you can run the `curl` command below to create an index
manually before running the wizard.
Default configs can be founded in the file `elastic-config.json`
> [!NOTE]
> The wizard automatically create an `elasticsearch` index.

```shell
$ curl -X PUT -H "Content-Type: application/json" -d @elastic-config.json localhost:9200/<index-name>
```
> [!TIP]
> Alternatively you can run the `curl` command below to create an index manually before running the wizard. Default configs can be founded in the file `elastic-config.json`

```shell
$ curl -X PUT -H "Content-Type: application/json" -d @elastic-config.json localhost:9200/<index-name>
```

6. Apply `django` migrations

```shell
(env)$ python manage.py migrate
(esquite)$ python manage.py migrate
```

7. Run `django` in background

```shell
(env)$ python manage.py runserver 0.0.0.0:8000 &
(esquite)$ python manage.py runserver 0.0.0.0:8000 &
```

8. Go to your browser at `http://localhost:8000/` to see Esquite running :)

**Note:** For an in detail deployment guide see please contact us
> [!NOTE]
> For an in detail deployment guide see please contact us

## Docker image alternative: `Esquite-Docker`

Expand Down Expand Up @@ -135,4 +136,3 @@ your parallel corpus? Contact us: *contacto at elotl.mx*
* Twitter: [@elotlmx](https://twitter.com/elotlmx)
* Site: [https://elotl.mx/](https://elotl.mx)
* Email: *contacto at elotl.mx*

122 changes: 66 additions & 56 deletions README_ES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,107 +18,117 @@ y frases en las dos lenguas.
* Personalización de la interfaz web
* Colores
* Teclado con caracteres especiales (útil para lenguas minorizadas)
* Agregar información personalizada a las vistas: **Ayuda**, **Acerca del Corpus**,
* Agregar `html` con información personalizada a las vistas: **Ayuda**, **Acerca del Corpus**,
**Links**, etc.
* Nuevas características en desarrollo


### Ejemplo: [Tsunkua Corpus Paralelo Español-Otomí](https://tsunkua.elotl.mx/)

<p align="center">
<img src="https://elotl.mx/wp-content/uploads/2020/07/tsunkua.png" width="40%" height="40%" />
<img src="https://elotl.mx/wp-content/uploads/2020/07/export_csv.png" width="52%" height="52%" />
<img src="docs/source/static/img/tsunkua.png" width="50%" />
<img src="docs/source/static/img/export_csv.png" width="45%" />
</p>

## Documentación

Para una [guía de instalación completa](https://esquite.readthedocs.io/es/latest/install.html), [tutoriales](https://esquite.readthedocs.io/es/latest/tutorials.html) y una explicación de la estructura del proyecto se puede revisar nuestra [documentación](https://esquite.readthedocs.io/es/latest/).

## Contacto

¿Eres hablante/estudioso de una lengua minorizada y te gustaría poner tu corpus
paralelo en línea? Contactamos: *contacto at elotl.mx*

### Colaboradoras

* **Leadership:** Xim ([@XimGuitierrez](https://twitter.com/XimGutierrez)) - *xim at unam.mx*
* **Mantainer:** Diego B. ([@umoqnier](https://twitter.com/umoqnier)) - *diegobarriga at protonmail.com*
* **DevOps**: Javier ([@jusafing](https://twitter.com/jusafing)) - *[email protected]*

### Comunidad

* Twitter: [@elotlmx](https://twitter.com/elotlmx)
* Sitio: [https://elotl.mx/](https://elotl.mx)
* Email: *contacto at elotl.mx*
## Dependencias

## Documentación
* [Elasticsearch 8.15](www.elastic.co/guide/en/elasticsearch/reference/8.15/elasticsearch-intro-what-is-es.html)
* `python 3.12` o mayor
* `uv`
* `git`

Para una [guía de instalación](https://esquite.readthedocs.io/es/latest/install.html)
completa, [tutoriales](https://esquite.readthedocs.io/es/latest/tutorials.html)
y estructura del proyecto puedes revisar nuestra
[documentación](https://esquite.readthedocs.io/es/latest/).
## Installation

### Dependencias
1. Instala y ejecuta `elasticsearch`

* `git`
* [Elasticsearch 7.6](https://www.elastic.co/guide/en/elasticsearch/reference/7.6/getting-started-install.html) o mayor
* `python3.6` o mayor
* `pip`
* Opcional: `virtualenv`: [Guía de instalación virtualenv](https://virtualenv.pypa.io/en/latest/installation.html)
> [!NOTE]
> Revisa la documentación oficial en la página de [Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/install-elasticsearch.html) para completar este paso dependiendo de tu Sistema Operativo. Alternativamente puedes usar [docker](https://www.elastic.co/guide/en/elasticsearch/reference/8.15/docker.html) para una instalación más sencilla.

### Instalación en servidor
> [!TIP]
> Quizá quieras deshabilitar las características de seguridad default de elasticsearch si estas corriendolo en tu red local o si solo estas realizando pruebas con esquite. Puede modificar el archivo en la ruta `/usr/share/elasticsearch/config/elasticsearch.yaml`.

1. Instalar y correr `elasticsearch`
2. [Instala](https://docs.astral.sh/uv/#installation) `uv` en tu sistema

**Nota**: Puedes consultar la página oficial de
[Elasticsearch](https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html)
para completar este paso dependiendo de tu Sistema Operativo
```shell
$ curl -LsSf https://astral.sh/uv/install.sh | sh
```

2. Clona este repositorio
3. Clona este repositorio de código

```shell
$ git clone https://github.com/ElotlMX/Esquite
$ git clone https://github.com/ElotlMX/Esquite --depth=1
```

3. Preparación del entorno

Entrar a la carpeta del proyecto, crea un entorno virtual de `python` con
`virtualenv` y activarlo
4. Instala dependencias

Cambiate al directorio del proyecto e instala las dependencias. Activa el entorno virutal del proyecto

```shell
$ cd Esquite
$ virtualenv env -p /usr/bin/python3
$ source env/bin/activate
$ uv sync --no-dev
$ source .venv/bin/activate
```

4. Instalar las dependencias
5. Lanza el wizard de instalación e introduce la información requerida

```shell
(env)$ pip install -r requirements.txt
(esquite)$ python wizard.py
```

5. Iniciar el asistente de instalación e ingresar los datos que piden
> [!NOTE]
> El wizard creará un índice de `elasticsearch` automáticamente

> [!TIP]
> Alternativamente puedes correr el comando `curl` que está a continuación para crear el índice manualmente antes de correr el wizard. Las configuraciones por defecto pueden encontrarse en el archivo `elastic-config.json`.


```shell
$ curl -X PUT -H "Content-Type: application/json" -d @elastic-config.json localhost:9200/<index-name>
```

6. Aplica las migraciones de `django`

```shell
(env)$ python wizard.py
(esquite)$ python manage.py migrate
```

**Nota**: El asistente menciona que debemos tener un índice de `elasticsearh`
previamente creado. Para crear dicho índice puede ejecutar el siguiente
comando.
7. Corre `django` en segundo plano

```shell
$ curl -X PUT -H "Content-Type: application/json" -d @elastic-config.json localhost:9200/<nombre-de-tu-indice>
(esquite)$ python manage.py runserver 0.0.0.0:8000 &
```

Donde dice `<nombre-de-tu-indice>` deberás poner el nombre que desees
y ese será el nombre del índice para poner en el asistente de instalación.
8. Ve a la dirección `http://localhost:8000/` en tu navegador par ver Esquite corriendo :)

6. Aplicar migraciones de `django`
> [!NOTE]
> Para una guia detalla de puesta en producción por favor contactanos.

```shell
(env)$ python manage.py migrate
```
## Docker image alternative: `Esquite-Docker`

6. Correr `django` en segundo plano
Alternativamente, es posible usar Esquite y ponerlo en producción de una forma más facil usando nuestra imagen oficial de docker.

```shell
(env)$ python manage.py runserver 0.0.0.0:8000 &
```
La documentación detallada esta disponible en los siguientes links:

- Esquite-Docker Github : https://github.com/ElotlMX/Esquite-docker
- Esquite-Docker Dockerhub : https://hub.docker.com/r/elotlmx/esquite

### Colaboradoras

* **Leadership:** Xim ([@XimGuitierrez](https://twitter.com/XimGutierrez)) - *xim at unam.mx*
* **Mantainer:** Diego B. ([@umoqnier](https://twitter.com/umoqnier)) - *diegobarriga at protonmail.com*
* **DevOps**: Javier ([@jusafing](https://twitter.com/jusafing)) - *[email protected]*

### Comunidad

* Twitter: [@elotlmx](https://twitter.com/elotlmx)
* Sitio: [https://elotl.mx/](https://elotl.mx)
* Email: *contacto at elotl.mx*
Binary file added docs/source/static/img/export_csv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 21 additions & 25 deletions esquite/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,18 @@


def keyboard(request):
"""**Configura variable de entorno para teclaod personalizado**
"""
return {'KEYBOARD': settings.KEYBOARD}
"""**Configura variable de entorno para teclaod personalizado**"""
return {"KEYBOARD": settings.KEYBOARD}


def languages(request):
"""**Configura variables de entorno de las lenguas**"""
return {'L1': settings.L1, 'L2': settings.L2}
return {"L1": settings.L1, "L2": settings.L2}


def colors(request):
"""**Configura variables de entorno para los colores**"""
return {'COLORS': settings.COLORS}
return {"COLORS": settings.COLORS}


def project_info(request):
Expand All @@ -33,40 +32,37 @@ def project_info(request):
static_path = settings.STATICFILES_DIRS[0]
default_banner = "img/banner.png"
default_logo = "img/logo.png"
banner_path = get_user_file(static_path, 'user/img/banner.png') or default_banner
logo_path = get_user_file(static_path, 'user/img/logo.png') or default_logo
banner_path = get_user_file(static_path, "user/img/banner.png") or default_banner
logo_path = get_user_file(static_path, "user/img/logo.png") or default_logo
return {
'PROJECT_NAME': settings.NAME,
'ORG_NAME': settings.ORG_NAME,
'COLABS': settings.COLABS,
'LINKS': settings.LINKS,
'META_DESC': settings.META_DESC,
'YEAR': current_year,
'BANNER_PATH': banner_path,
'LOGO_PATH': logo_path,
'USER_CSS_FILES': get_user_files(static_path, 'user/css/'),
'USER_JS_FILES': get_user_files(static_path, 'user/js/')
"PROJECT_NAME": settings.NAME,
"ORG_NAME": settings.ORG_NAME,
"COLABS": settings.COLABS,
"LINKS": settings.LINKS,
"META_DESC": settings.META_DESC,
"YEAR": current_year,
"BANNER_PATH": banner_path,
"LOGO_PATH": logo_path,
"USER_CSS_FILES": get_user_files(static_path, "user/css/"),
"USER_JS_FILES": get_user_files(static_path, "user/js/"),
}


def google_analytics(request):
"""**Configura variables de entorno de google analytics**"""
return settings.GOOGLE_ANALYTICS


def user_templates(request):
views = ["about", "help", "links", "participants"]
regex = re.compile("[\w+\.\\n+\b+]$", re.MULTILINE)
regex = re.compile(r"[\w+\.\\n+\b+]$", re.MULTILINE)
user_views = {}
for view in views:
path = f"{settings.BASE_DIR}/templates/user/{view}-user.html"
try:
with open(path, 'r') as html:
with open(path, "r") as html:
html_view = html.read()
html_view = regex.sub("<br>", html_view)
html_view += "<br>"
except FileNotFoundError:
LOGGER.warning(f"User template={view} not found. Path=templates/user/{view}-user.html")
LOGGER.warning(
f"User template={view} not found. Path=templates/user/{view}-user.html"
)
html_view = ""
name = view.upper() + "_USER"
user_views[name] = html_view
Expand Down
Loading