From ba2138a1afb243571bdeb6e9d8a3a25a98347357 Mon Sep 17 00:00:00 2001 From: FrederikBaerentsen Date: Thu, 26 Dec 2024 18:17:54 +0100 Subject: [PATCH] Updated readme and first time running --- README.md | 3 +++ app.py | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ea5623..e9fda59 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ A web application for organizing and tracking LEGO sets, parts, and minifigures. ```bash git clone https://gitea.baerentsen.space/FrederikBaerentsen/LEGOOrganizer.git cd LEGOOrganizer +mkdir static/{sets,instructions,parts} ``` 2. Create a `.env` file with your configuration: @@ -31,6 +32,8 @@ REBRICKABLE_API_KEY=your_api_key_here DOMAIN_NAME=https://your.domain.com ``` +If using locally, set `DOMAIN_NAME` to `http://localhost:3333`. + 3. Deploy with Docker Compose: ```bash docker compose up -d diff --git a/app.py b/app.py index 1b47e01..eaddba9 100644 --- a/app.py +++ b/app.py @@ -508,7 +508,15 @@ def generate_unique_set_unique(): @app.route('/',methods=['GET','POST']) def index(): set_list = [] - theme_file = np.loadtxt("themes.csv",delimiter=",",dtype="str") + try: + theme_file = np.loadtxt("themes.csv",delimiter=",",dtype="str") + except: #First time running, no csvs. + initialize_database() + urls = ["themes","sets","colors"] + for i in urls: + download_and_unzip("https://cdn.rebrickable.com/media/downloads/"+i+".csv.gz") + get_nil_images() + return redirect('/create') if request.method == 'GET':