This is the class extension "NemoFormulae" for flask_nemo. A working instance of this extension for the Formulae - Litterae - Chartae Project can be found at https://werkstatt.formulae.uni-hamburg.de.
Further information:
- https://github.com/capitains/tutorial-nemo
- The app is configured via formulae/app.py
- Complete documentation should be done using Sphinx
Only needs to be executed before the first time running the app:
- Clone the repositories:
git clone formulae-capitains-nemo(code-base)git clone formulae-corpora(texts) (ideally in the same folder e.g.,gitas the code base)
- Create a Python virtualenv (e.g.,
virtualenv --python=python3 .venv) - Only if needed: Set the environment variable
CORPUS_FOLDERSand re-start the app.
- activate the virtualenv (e.g.,
source .venv/bin/activate) - install the requirements via
pip install -r requirements.txtwithin in the venv and from theformulae-capitains-nemofolder - Optional: set-up Elastic Search via:
.env - For local development:
ELASTICSEARCH_URL = "http://localhost:9200"-> requires: local elastic search instance - If the requirements have been installed properly, you can launch
python3 app.pywithin the venv and informulae-capitains-nemofolder - Reach the site via 127.0.0.1:5000
- Make sure that you have a few Gigabytes of RAM free
- cd
formulae-capitains-nemofolder docker-compose up- es8 exited with code 137 -> Not enough memory free
The application can be started locally using Docker Compose. The setup includes:
- Elasticsearch – search index backend
- Redis – temporary storage for search workflows
- formulae_corpora – helper container that clones/updates the XML corpus and can rebuild the search index
- nemo – the Flask web application
- Docker
- Docker Compose
Create a .env file in the project root:
ELASTICSEARCH_URL=http://elasticsearch:9200
FORMULAE_CORPORA_REPO_URL=<repository>
GITHUB_TOKEN=<github-token>
FORMULAE_CORPORA_REF=
REBUILD_ELASTICSEARCH=false docker compose up -d elasticsearch redis
docker compose run --rm formulae_corpora
docker compose up -d nemo💻 Application URL: http://localhost:5000
docker compose downdocker-compose up --build- https://flask.palletsprojects.com/en/2.3.x/quickstart/#static-files
- I do recommend to add
/staticand/robots.txtto your nginx configuration, so that are served directly without passing through the application.
- Install sphinx: https://www.sphinx-doc.org/en/master/usage/installation.html
- For Debin/Ubuntu the OS-specific package manager worked best
- activate the virtualenv (e.g.,
source .venv/bin/activate) - install the requirements via
pip install -r requirements_sphinx.txtwithin in the venv and from theformulae-capitains-nemofolder - Build the project:
sphinx-build -M html docs/source/ docs/build/orpython -m sphinx -M html docs/source/ docs/build/ - Open
docs/build/html/index.htmlwith your preferred browser:firefox docs/build/html/index.html
- Currently, we do not follow any specific design pattern. In the future I would to "reduce the weight" of our fat controller formulae/app.py. I have not fully decided on whether I want to have fat models or fat services instead; at the end services vs. models is more a naming thing than a real decision. Alternatively, I could do the MVC-pattern.
- Each new collection should
- Install GitHub CLI
- Install act:
gh extension install https://github.com/nektos/gh-act - cd git/formulae-capitains-nemo
gh act -W '.github/workflows/python-app.yml'orgh act -W '.github/workflows/documentation.yml'- Comment out the redis port (gh seems to bring its own redis instance)