86 lines
2.2 KiB
Markdown
86 lines
2.2 KiB
Markdown
# jon
|
|
|
|
> the tamer of garfield
|
|
|
|
## Setup
|
|
|
|
`jon` is a Python WSGI application written using Flask.
|
|
This means you'll have to install a bunch of Python packages to get up and running.
|
|
|
|
### Dependencies
|
|
|
|
```
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
You should probably use a virtualenv for that.
|
|
I develop `jon` using Python 3.10 but it should work with older versions as well.
|
|
|
|
#### Arch Linux
|
|
|
|
If you're on Arch, these packages are required for running the server:
|
|
|
|
```
|
|
python python-flask python-flask-login python-psycopg2
|
|
```
|
|
|
|
### Building Frontend JS
|
|
|
|
Most of jon works without JS but there are some features that require it.
|
|
The frontend code lives in `./frontend` and is written using Elm, a functional language that compiles to JS.
|
|
To compile the Elm code to `.js` files, first make sure that the Elm compiler is installed:
|
|
|
|
```
|
|
elm --version
|
|
# 0.19.1
|
|
```
|
|
|
|
Then run `make frontend`.
|
|
|
|
## Running
|
|
|
|
```
|
|
flask --app jon run --debug
|
|
```
|
|
|
|
`--debug` restarts the server when a source file changes.
|
|
|
|
## Running with docker
|
|
When you prefer running the application using docker you can just use
|
|
```
|
|
docker compose up
|
|
```
|
|
|
|
In case your local username does not line up with your FSMI-username, you need to specify your FSMI-username
|
|
using `USER=<username>`, e.g.:
|
|
```
|
|
USER=shirkanesi docker compose up
|
|
```
|
|
|
|
This can also be persisted by following the instructions in the docker-compose.yml
|
|
|
|
## fsmi-db forward
|
|
|
|
```
|
|
ssh -nNTvL 5432:fsmi-db.fsmi.org:5432 fsmi-login.fsmi.uni-karlsruhe.de
|
|
```
|
|
|
|
## TODO
|
|
|
|
- [ ] Implement and document report generation
|
|
- [ ] How many days will the item last?
|
|
- [ ] How many do we need to last X months?
|
|
- [ ] etc.
|
|
- [ ] Make it print nicely
|
|
- [ ] Make it possible to edit entries
|
|
- [ ] Fix unsafe client-side sessions, either:
|
|
- [ ] Use `flask-session` for file-backed sessions
|
|
- [ ] Use `flask-login` with a single user stored in memory
|
|
- [ ] Improve project structure
|
|
- [ ] Use `flask.flash` for error messages
|
|
- [x] Implement item and snack entry as Elm application
|
|
- [x] Figure out/Add documentation about building `entry.js`
|
|
- [ ] Clean up the code a little and add some comments
|
|
- [ ] Needs good documentation for maintainability
|
|
- [ ] Use cool new function for deactivating items
|