formulae-capitains-nemo documentation
formulae-capitains-nemo
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.
Getting Started
Further information:
https://github.com/capitains/tutorial-nemo
The app is configured via formulae/app.py
Runnning the app locally:
1. Preliminary setup steps:
Only need to be executed the 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.,git
as the code base)
Create a Python virtualenv (e.g.,
virtualenv --python=python3 .venv
)Only if needed: Set the environment variable
CORPUS_FOLDERS
and re-start the app.
2. Start the app:
activate the virtualenv (e.g.,
source .venv/bin/activate
)install the requirements via
pip install -r requirements.txt
within in the venv and from theformulae-capitains-nemo
folderOptional: set-up Elastic Search via:
.env
For local development:
ELASTICSEARCH_URL = "http://localhost:9200"
-> requires: local es instanceIf the requirements have been installed properly, you can launch
python3 app.py
within the env and informulae-capitains-nemo
folderReach the site via 127.0.0.1:5000
Run Elastic Search local
Make sure that you have a few Gigabytes of RAM free
cd
formulae-capitains-nemo
folderdocker-compose up
es8 exited with code 137 -> Not enough memory free
How are static files handled?
https://flask.palletsprojects.com/en/2.3.x/quickstart/#static-files
I do recommend to add
/static
and/robots.txt
to your nginx configuration, so that are served directly without passing through the application.
How to run the SPHINX documentation locally:
Install sphinx: https://www.sphinx-doc.org/en/master/usage/installation.html
For Debin/Ubuntu the OS-specific package manager worked best
Build the project:
sphinx-build -M html docs/source/ docs/build/
Open
docs/build/html/index.html
with your preferred browser:firefox docs/build/html/index.html
Contribution guide
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
Run GitHub-actions locally:
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'
Comment out the redis port (gh seems to bring its own redis instance)