commit 540b3af694cecfa7a5c39718692a386fc0988667
parent 781eb5290ceed0a222624b3a781025b1bc1ccba0
Author: Asher Morgan <59518073+ashermorgan@users.noreply.github.com>
Date: Thu, 28 Mar 2024 14:18:21 -0700
Update README.md and improve .env loading
Diffstat:
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -6,3 +6,6 @@
# Virtual environment
.venv
+
+# Environment variables
+.env
diff --git a/README.md b/README.md
@@ -1,2 +1,20 @@
# Songs2Slides
-Creates a lyrics powerpoint from a list of songs
+Creates a lyrics slide show from a list of songs
+
+## Setup
+1. Install python dependencies
+```
+python3 -m pip install -r requirements.txt
+```
+
+2. Add variables to `.env` file
+```
+API_URL="http://exampl.com/get-lyrics?title={title}&artist={artist}"
+```
+
+3. Run app in debug mode
+```
+flask --app songs2slides run --debug
+```
+
+4. Visit [localhost:5000](http://localhost:5000)
diff --git a/songs2slides/__init__.py b/songs2slides/__init__.py
@@ -1,4 +1,5 @@
from flask import Flask, render_template
+from dotenv import load_dotenv
def error_404(e):
return render_template('error.html', message='404 Not Found'), 404
@@ -6,6 +7,8 @@ def error_404(e):
def create_app():
app = Flask(__name__)
+ load_dotenv()
+
from . import routes
app.register_blueprint(routes.bp)
app.register_error_handler(404, error_404)
diff --git a/songs2slides/core.py b/songs2slides/core.py
@@ -1,5 +1,4 @@
from dataclasses import dataclass
-from dotenv import load_dotenv
import pptx
from pptx.dml.color import RGBColor
from pptx.enum.text import MSO_ANCHOR, PP_ALIGN