# Isa
This tool helps to describe the images contributed to Wiki Loves competitions.
Isa is not only an acronym for information structured additions, but is also a chiShona language word for ‘put’.
Install application dependencies using the get-deps.sh
script:
./get-deps.sh
The above script attempts to check system requirements and informs user on next steps.
Add a database, e.g. for Mysql:
create database isa;
and create all the tables. in Python run:
from isa import db from isa.models import * db.create_all()
Then set the config variable in config.yaml, e.g.:
SQLALCHEMY_DATABASE_URI: 'mysql+pymysql://localhost/isa' CELERY: broker_url: redis://localhost
Then start Flask:
export FLASK_APP=app.py # add --reload parameter to enable Flask auto-compilation feature flask run
If you want to run ISA during development you can set the config variable ISA_DEV
to true
. This will allow you to use it as normal with all actions being made by the user "Dev". No changes will be made to Commons.
You need to create the user manually by running the following Python code:
from isa.users.utils import add_user_to_db add_user_to_db("Dev")
Steps 1 to 3a below show how to extract and generate translation files from the source code.
Start from step 3b if you are only adding a new supported language for the app.
Start from step 4 if you are only adding translated text for already supported languages.
Skip directly to step 5 if you have pulled changes which include updated translations (edited .po files).
All commands should be run from the /isa subfolder.
Mark new strings to be translated using formats shown below:
run pybabel extract -F babel.cfg -o messages.pot --input-dirs=.
This step is only needed after changes have been made to translatable text in the source code in step 1.
run pybabel update -i messages.pot -d translations -l <lang_code>
Use this command to update .po files for each supported language.
It will merge in any new strings found in the .pot file generated in step 2. Any strings that are no longer found are placed at the bottom of the file, using commented out lines beginning with #~
run pybabel init -i messages.pot -d translations -l <lang_code>
Use this command to create a new .po file.
This step is only needed when adding a new supported language. Commit the new .po file to source control.
Add the actual translated text for each language to the corresponding .po file located at isa/translations/<lang_code>/LC_MESSAGES/messages.po
This step should be completed by translators, so can happen at any time. Commit any changes to .po files to source control.
run pybabel compile -d translations
Once translations are ready from step 4 (or from pulling changes with updated .po files), you need run the compile command before seeing the new translations in the app.
To run tests from the applications root directory, use the command nose2 -v tests.<test_module_name>
To get a blueprint's coverage, run following commands:
coverage run -m unittest discover
coverage report -m isa/<blueprint_name>/*.py>
Maintenance scripts are found in isa/maintenance. Run them as modules in the root directory, e.g. python -m isa.maintenance.update_campaign_images
.
Migrations are found in isa/migrations. After a new install, or upon upgrade run the following commands:
flask db stamp head
flask db migrate
flask db upgrade
ISA development has been supported by: