-
Notifications
You must be signed in to change notification settings - Fork 15
Home
ped·a·go·gy /ˈpedəˌɡäjē/ the method and practice of teaching, especially as an academic subject or theoretical concept.
Pedagogy apps is a performance management tools for education professionals. It is developed within Algoritma, a data science education center.
Pedagogy is developed using flask, a web framework written in Python. It implements MVC as its architectural pattern. The apps uses a MySQL database as the database production, and a masked version stored in SQLite as the development database.
This section will guide you to setup your machine in development environment, the steps are done using Anaconda.
After cloning the repository, prepare a conda environment to store all the packages needed.
conda create -n envname
conda activate envname
Replace envname
as any environment name of your choice. Then, proceed to downloading all packages stored in requirements.txt
file within the repository into your newly-made environment using pip
command.
pip install -r "requirements.txt"
After setting up your environment, you need to prepare environment variables in your machine. By default, a flask run
command would run the application in production environment, the required variables are:
MYSQL_HOST
MYSQL_USER
MYSQL_PASSWORD
MYSQL_DATABASE
When flask run
is executed, it will automatically run __init__.py
file within the app folder. The script will automatically source config.py
file and use the required variables to create a connection to the production database. For development objectives, the application will create a connection to development database, an SQLite file stored in the repository. To change into development environment create an environment variable called FLASK_ENV
:
# for windows
set FLASK_ENV=development
# for mac / linux
export FLASK_ENV=development
Then run flask run
to run the application.
The directory structure is created as follow:
.
├───app
│ ├───static
│ │ └───css
│ ├───templates
│ ├───__init__.py
│ ├───adminconf.py
│ ├───analytics.py
│ ├───email.py
│ ├───errors.py
│ ├───forms.py
│ ├───models.py
│ ├───routes.py
│ ├───survey.py
│ ├───users.py
├───config.py
├───populate.py
├───requirements.txt
├───test.db
├───migrations
The flask run
command will automatically run __init__.py
within app directory. It will source configuration settings from config.py
in root directory. It will also create an SQL connection (MySQL/SQLite) depending on which environment it is run on. The SQLite database used for development is stored in root directory, test.db
. To update the development DB with the new data, run populate.py
script to query the new data from the production database.
The models for this app is defined in models.py
within app directory and consist of 4 different tables: Employee, Workshop, Response, and TA Assignment. Other imported model is User model and is a UserMixin
extension from flask-login
library defined in users.py
. The database is created through migration from these models.
The view side is stored in ~/app/templates
directory and the controller for each view render is defined in routes.py
within app directory. Other function modules is imported as needed in the routes.py
.