From 7b7af30b84ec430a6fccfe4d81df0119c773665c Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Fri, 15 Nov 2024 17:18:00 +0100 Subject: Changed the code base with an ADR --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 42ca714..93f656e 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,10 @@ pythonw -m flask run -p Create a task using Task Scheduler to run this script on start up. -## Background / Motivation +## Architectural Design Record -This part of the README focuses on the motivation of why this application was built and contains no technical value. Please read on in case you want to know more about the technological choices made. +This part of the README focuses on the motivation of why this application was built and contains background information. Please read on in case you want to know more about the technological choices made. -> I am part of a badminton club where an old Microsoft Access application was being used to run the games played every week. The application started crashing after a good run of a few years and also lacked a few badly needed features. Instead of fixing the old application, I took it upon myself to create something using tools that are more suited for such an application. I wanted to prioritize delivery speed for performance and hence choose Python. More over, the sheer number of Python programmers allows for the application to be easily maintained by others. I myself have no idea how Microsoft Access works. Since it was quite a small application, I went with Flask as it was more than enough for the features that I needed instead of Django. I have a background in electrical engineering and having never made frontends before, went with the simplest option for the user interface after a bit of research. HTMX required no need of me writing JavaScript and was by far the most appealing option. The website needed some basic styling and after looking at a few CSS frameworks, I settled with Bulma. It gives me everything I need. The application is scheduled to be deployed. +- Python was choose to prioritize delivery speed not for performance. More over, the sheer number of Python programmers allows for the application to be easily maintained by others. +- Flask was choosed as it more than enough for the features that I needed instead of Django. The application is to run locally on a laptop and doesn't really need to have complicated features. +- Due to a lack of frontend developers, the simplest UI stack was choosen. HTMX requires no need of JavaScript and was a natural choice. The website needed some basic styling and after looking at a few CSS frameworks, Bulma provided most of the styling. A toasting library, "Notyf" was also used for simple notifications to be sent via some custom javascript code for a simple timer. -- cgit v1.3.1 From d19720741fd37ea0a4b8a79f4f445bccdd360089 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Fri, 15 Nov 2024 17:25:22 +0100 Subject: Added the change to the README to follow the new package way of working --- README.md | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 93f656e..27203ab 100644 --- a/README.md +++ b/README.md @@ -27,35 +27,35 @@ What this application ***IS NOT***: - Secure: This was designed to be used locally on a machine - Performant: It was designed for use by a single admin user -## How to run +## How to install + +With [python](https://realpython.com/installing-python/) installed, run the following command preferably in a seperate virtual environment. + +### Using pip + +```bash +pip install git+https://gitlab.com/KaranJayachandra/match_up.git +``` + +### How to complile from source Please install [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [python](https://realpython.com/installing-python/) on your machine before proceeding further. Once installed, open the terminal to a folder of your choosing and run the following commands to setup the application. -```powershell +```bash git clone https://gitlab.com/KaranJayachandra/match_up.git cd match_up python -m venv .venv .venv\Scripts\activate -pip install -r requirements.txt +pip install . ``` -Now create a file called .env with the environment variables needed by the application. An example is shown below. - -```text -DATABASE = "database.csv" -COURTS = 10 -APP_SETTINGS = "config.DevelopmentConfig" -``` - -The `DATABASE` variable contains the list of players which is just a simple CSV file with two columns, the first containing their name and the second containing their skill level from 1 to 10. The `COURTS` variable is the number of spaces or slots you have for creating pairings. `APP_SETTINGS` should be chosen between `config.DevelopmentConfig` or `config.ProductionConfig` based on the deployment. - -The application can then be run using (ensure you are in the virtual environment if you closed the terminal after the previous steps): +To run the application, just run: -```powershell -flask run +```bash +match_up ``` -The application should be running now and the terminal should display the ip and port number. Most modern terminals will allow you to navigate directly to the application by clicking on the displayed address. +The application should be running now in 'localhost', just navigate there using a browser. Use the `--help` option to get an explanation of the application. ## Technology used @@ -65,11 +65,9 @@ This is a simple application build using [flask](https://flask.palletsprojects.c Create a powershell script with the following content in the folder with the code. -```powershell -$env:DATABASE = ".csv" -$env:APP_SETTINGS = "config.ProductionConfig" +```bash .venv\Scripts\activate -pythonw -m flask run -p +pythonw match_up ``` Create a task using Task Scheduler to run this script on start up. -- cgit v1.3.1