diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-16 11:46:39 +0200 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-16 11:46:39 +0200 |
| commit | f6f8cb4f1bf643a8d29f917d5c977cb2343f2672 (patch) | |
| tree | 8bbd6d244e0f19196a71d67274f25da29f01a44a | |
| parent | fbed8387a39e42cee7235384d7f8380ee158a3b3 (diff) | |
Clean folder and configuration
| -rw-r--r-- | app.py | 7 | ||||
| -rw-r--r-- | config.py | 9 | ||||
| -rw-r--r-- | gen_test_data.py | 2 | ||||
| -rw-r--r-- | model.py | 4 |
4 files changed, 7 insertions, 15 deletions
@@ -4,13 +4,10 @@ from controller import RoundGenerator from model import CourtList, PlayerList from flask import Flask, render_template, request - load_dotenv() - - app = Flask("Match Up! Backend") -app.config.from_object(getenv("PROD_APP_SETTINGS", "config.DevelopmentConfig")) -rg = RoundGenerator(courts=CourtList(12), players=PlayerList("test_data_large.csv")) +app.config.from_object(getenv("PROD_APP_SETTINGS")) +rg = RoundGenerator(courts=CourtList(12), players=PlayerList(getenv("DATABASE"))) @app.route("/", methods=["GET"]) @@ -5,12 +5,8 @@ class Config: ASSETS_DEBUG = False -class YouthConfig(Config): - DATABASE = "test_data_large.csv" - - -class SeniorConfig(Config): - DATABASE = "test_data_large.csv" +class ProductionConfig(Config): + pass class DevelopmentConfig(Config): @@ -18,4 +14,3 @@ class DevelopmentConfig(Config): DEVELOPMENT = True TEMPLATES_AUTO_RELOAD = True ASSETS_DEBUG = True - DATABASE = "test_data_large.csv" diff --git a/gen_test_data.py b/gen_test_data.py index bf11653..a49594f 100644 --- a/gen_test_data.py +++ b/gen_test_data.py @@ -1,7 +1,7 @@ from csv import writer from random import randint from names import get_full_name -from ..model import Player, MIN_LEVEL, MAX_LEVEL +from model import Player, MIN_LEVEL, MAX_LEVEL PLAYER_COUNT = 80 @@ -55,10 +55,10 @@ class CourtList: @dataclass class PlayerList: - location: Path + location: str def __post_init__(self) -> None: - with open(self.location, newline="") as file: + with open("data/" + self.location, newline="") as file: pointer = reader(file) next(pointer, None) players = { |
