S.A.R.A. is an acronym for the Results and Learning Evaluation System (or Sistema de Avaliação de Resultados e Aprendizados in Portuguese) and it is a software meant for recording and evaluating activities quantitative and qualitative metrics.
- About the Project
- Tech Stack
- Project Structure
- Getting Started
- Running the Project
- Tests
- Internationalization (i18n)
- Code Style & Quality
- Deployment
- Common Commands
- Troubleshooting
- Contributing
- License
- This is a Django-based web application for managing reports of activities, registering the metrics and learnings, and providing aggregated metrics reports.
- Can be used and adapted by any organization, Wikimedia affiliate or user group.
- It offers multilingual support and robust fallback logic for translated fields.
- Python: 3.9.2
- Django: 4.2.27
- Database: MariaDB / SQLite
- Frontend: Django Templates
- Other:
- django
- pandas
- whitenoise
- xlsxwriter
- django-admin-logs
- django_select2
- requests
- xhtml2pdf
- pdfkit
- social-auth-app-django
- django-modeltranslation
├───agenda
│ ├───management
│ │ └───commands
│ ├───migrations
│ ├───templates
│ │ └───agenda
│ └───templatetags
├───bug
│ ├───migrations
│ └───templates
│ └───bug
├───locale
├───metrics
│ ├───migrations
│ ├───templates
│ │ └───metrics
│ └───templatetags
├───report
│ ├───migrations
│ └───templates
│ └───report
├───sara
│ ├───asgi.py
│ ├───settings.py
│ ├───settings_local.py
│ ├───urls.py
│ ├───wsgi.py
├───static
│ ├───css
│ ├───images
│ └───js
├───strategy
│ └───migrations
├───templates
├───users
│ ├───migrations
│ └───templates
│ └───users
└───utils
Make sure you have installed:
- Python >= 3.9.2
- pip
- Virtualenv (recommended)
- Database server (if not using SQLite)
Clone the repository:
git clone https://github.com/wikimediabrasil/sara.git
cd saraCreate and activate a virtual environment:
python -m venv .venv
source .venv/Scripts/activateInstall dependencies:
pip install -r requirements.txtCreate a settings_local.py file based on settings_local_example.py:
SECRET_KEY— Django secret keyDEBUG— Debug mode flagALLOWED_HOSTS— Allowed hostnames/domains
POA_URL— Plan of Activities URLSTRATEGY_URL— Strategy Plan URL
SARA_MAINTENANCE_MODE— Enables maintenance mode, when you needENABLE_BUG_APP— Enables bug reporting featureENABLE_AGENDA_APP— Enables public agenda feature
-
REPORT_TIMESPANS— Time aggregation configuration for reportstrimestersemesteryear
-
Each timespan defines:
periods— Date ranges as((month, day), (month, day))total— Full date rangelabels— Human-readable labels
LANGUAGES— Supported languagesMODELTRANSLATION_DEFAULT_LANGUAGE— Default translation languageMODELTRANSLATION_FALLBACK_LANGUAGES— Fallback languages
All the instructions about requesting the OAuth consumer on Wikimedia is available here.
SOCIAL_AUTH_MEDIAWIKI_KEY— OAuth keySOCIAL_AUTH_MEDIAWIKI_SECRET— OAuth secretSOCIAL_AUTH_MEDIAWIKI_URL— MediaWiki OAuth endpointSOCIAL_AUTH_MEDIAWIKI_CALLBACK— OAuth callback URLSEND_USER_AGENT— Enables custom User-AgentUSER_AGENT— Custom User-Agent string
EMAIL_BACKEND— Django email backendEMAIL_HOST— SMTP hostEMAIL_PORT— SMTP portDEFAULT_FROM_EMAIL— Default sender addressEMAIL_HOST_USER— SMTP usernameEMAIL_HOST_PASSWORD— SMTP passwordEMAIL_USE_TLS— TLS enable flagEMAIL_USE_SSL— SSL enable flagEMAIL_COORDINATOR— Coordinator contact email
HOME— User home directoryreplica_path— Toolforge replica config path
tunnel— SSH tunnel for Toolforge MySQL access
-
DATABASES— Django database configuration- MySQL via SSH tunnel (local)
- MySQL via
replica.my.cnf(production) - SQLite3 fallback (local)
-
config— ConfigParser instance forreplica.my.cnf
Apply migrations:
python manage.py migrateCreate a superuser:
python manage.py createsuperuserStart the development server:
python manage.py runserverAccess the application at:
Run the full test suite:
python manage.py testRun a specific app:
python manage.py test apps.usersThis project supports multiple languages.
Create message files:
python manage.py makemessages -l pt_BRCompile translations:
python manage.py compilemessagesLanguage fallback logic is implemented at the application level (see relevant utility functions).
Recommended tools:
- Black – code formatting
- isort – import sorting
- ruff – linting
black .
isort .
ruff check .High-level deployment steps:
- Set
DEBUG=False - Configure
ALLOWED_HOSTS - Collect static files:
python manage.py collectstatic- Apply migrations
- Configure WSGI/ASGI (uWSGI)
- Set up a reverse proxy (Nginx)
python manage.py makemigrations
python manage.py migrate
python manage.py shell
python manage.py createsuperuser
python manage.py collectstaticProblem: Migrations out of sync
python manage.py makemigrations --checkProblem: Duplicate rows in queries
- Check joins
- Use
Subquery,Exists, ordistinct()carefully
Problem: Wrong language field selected
- Verify
LANGUAGE_CODE - Check fallback configuration
- Fork the project
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes
- Push to the branch
- Open a Pull Request
Follow existing code style and include tests.
This project is licensed under the MIT License.
See the LICENSE file for details.