A tool to track attendance for AMIV events written in Python 3. It allows to see a list of all signed up people of an event, GV, or a PVK course (PVK attendance tracking not yet implemented.) Every participant can then be checked-in and out either via the web frontend or JSON based API endpoints. In conjunction with the check-in Android App and iOS App amiv-checkin offers quick and efficient tracking of attendance statistics and admission.
The tool currently supports two types of events:
- AMIV Events from the amivapi
- General Assemblies (GV) taking it's member data from amivapi
As helpers (like Kulturis) might not have the full administrative rights to modify participant lists in the data backends (eventsignups in amivapi), this tool allows the delegation of permission via an 8 digit PIN. The PIN can be used to authenticate check-in or check-out participants of a single event by anyone who knows the PIN. To setup the attendance tracking for an event, a user with sufficient privileges has to initialize the PIN.
Many thanks to the great FLASK tutorials here and here.
If you want to write your own frontend for checkin / checkout, see the API documentation at README_API.md.
is done via GitLab CI pipeline. Launch the "deploy" job manually from the commits view in GitLab to deploy the app to the ISG.EE server. The webapp is reachable at checkin.amiv.ethz.ch. uWSGI is used to serve the app behind the ISGs apache web server and the ISG's SQL server holds the database.
To start the app locally for development, do the following (shell code is for the fish-shell):
- clone this repo
- create a python3 virtual environment:
virtualenv env
- and activate it:
source env/bin/activate.fish
- install the requirements inside the virtualenv:
pip install -r requirements.txt
- set the following environment variables:
set -x FLASK_APP run.py
,set -x FLASK_CONFIG development
, andset -x FLASK_DEBUG 1
- create the local settings file with all the juicy secrets inside in
instance/config.py
. The two following options must be set:SQLALCHEMY_DATABASE_URI
andSECRET_KEY
. See next section. - run the flask app:
flask run
- Install Mysql (on MacOs:
brew install mysql
) and make sure it's running (on MacOS:brew services start mysql
) - Install a MySql client for python, for instance
mysqlclient
(pip install mysqlclient
) - Crete user and database on mysql:
- Connect to MySQL:
mysql -u root
- Create user
CREATE USER '%USER%'@'localhost' IDENTIFIED BY '%PASSWORD%';
, replacing %USER% and %PASSWORD% - Create DB:
CREATE DATABASE %DB_NAME%;
, replacing %DB_NAME% - Give all privileges
GRANT ALL PRIVILEGES ON %DB_NAME%.* TO '%USER%'@'localhost';
, replacing %DB_NAME% and %USER%
- Connect to MySQL:
- Edit your
config.py
:- Set
SECRET_KEY
to some random string - Set
SQLALCHEMY_DATABASE_URI
tomysql://%USER%:%PASSWORD%@localhost/%DB_NAME%
- Set
- Upgrade DB to correct state:
flask db upgrade
Do the following if your code changes require any changes of the database schema:
- Make sure that your local database schema is equal to the last committed migration file (found in the directory
migrations/
) - Generate new migration file with
flask db migrate
. - Apply your changes to the local development database with
flask db upgrade
. - Verify that everything is ok with the database schema.
- Commit the created migrations file. DO NOT CHANGE any migration file which is already committed!
- Get the latest version of python version 3.x at: https://www.python.org/downloads/
- For setting up flask see the installation guide at the docs: http://flask.pocoo.org/docs/0.12/installation/
Then to run the flask app quickly for a new cmd paste the code below
cd c:/users/path/to/project/root venv\Scripts\activate pip install flask pip install requirements.txt
Only call flask run once you have finished all the stepscd c:/users/path/to/project/root venv\Scripts\activate set FLASK_APP=run_local.py set FLASH_CONFIG=development set FLASK_DEBUG=1 flask run
- Get the latest mySQL installer here: https://dev.mysql.com/downloads/windows/installer/
- Choose the server only option.
- After installation the installer will continue to configure the mySQL server, set a password and create a user with password (all still part of the installer)
- Follow the instructions above for creating a local DB from the step to create a database, but use the separate MySql Command Line Client which is now installed, not cmd. If there are errors check syntax and try with/out quotes/spaces.