aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app.py7
-rw-r--r--config.py9
-rw-r--r--gen_test_data.py2
-rw-r--r--model.py4
4 files changed, 7 insertions, 15 deletions
diff --git a/app.py b/app.py
index a81bde0..40b75a1 100644
--- a/app.py
+++ b/app.py
@@ -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"])
diff --git a/config.py b/config.py
index bff125a..7d01933 100644
--- a/config.py
+++ b/config.py
@@ -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
diff --git a/model.py b/model.py
index 3e76085..ba5cb9b 100644
--- a/model.py
+++ b/model.py
@@ -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 = {