Skip to content

NTNUI/skjema

refusjon-master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Refusjonsskjema NTNUI

Based on webkom/kvittering, configured to run as a normal docker container.

Handles refund requests for NTNUI.

Development

This is one docker image that serves both the Python API, and the Next.js/React frontend. This is done by building the webapp as a static site, and serving it as static files through flask. Be aware that some of the python imports does not support development in Windows.

To run just the frontend:

  • Install all packages with yarn
  • Start the server with yarn dev
  • Export the static files with yarn build && yarn export

To run the backend/everything:

  • Make a virtual env with python -m venv venv
  • Enter the env with source venv/bin/activate
  • Install packages with pip install -r kaaf/req.txt
  • Start the server with python kaaf/server.py
  • If the frontend is exported (yarn export), the webapp will be available at localhost:5000 when running server.py

One of the packages (pdf2image) will require poppler to work correctly with tmp files. Most linux distros come with this. For MacOS brew install poppler

Generating PDFs

It might be nice to be able to quickly generate PDFs when developing, without having to start up everything. To do this you can run:

python kaaf/generate-example.py signature.png output.pdf image0.png image1.png ...

Where signature.png and imageN.png are paths to image files (the latter images are optional)

Environment variables

Variable Function
MAIL_ADDRESS Set the mail address for generated receipts
MAIL_PASSWORD Password for the mail account
ENVIRONMENT Set to "production" for sentry errors
SENTRY_DSN Ingest errors to sentry