diff --git a/app/database.py b/app/database.py index 8c73a0a..3e7ecf5 100644 --- a/app/database.py +++ b/app/database.py @@ -9,7 +9,7 @@ entry_table = "entries" index_label = "Id" def open_db(): - conn = sqlite3.connect("test.db") + conn = sqlite3.connect("data/test.db") conn.execute('PRAGMA encoding = "UTF-8";') return conn diff --git a/app/helpers.py b/app/helpers.py index d2a5e63..5ac2a0d 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -3,7 +3,13 @@ from bs4 import BeautifulSoup import json import os -config_file = "config.json" +data_directory = "data" +config_file = data_directory+"/config.json" + +def create_data_directory(): + if not os.path.exists(data_directory): + os.makedirs(data_directory) + def get_catalog_url(): r = requests.get('https://www.karafun.de/karaoke-song-list.html') diff --git a/app/main.py b/app/main.py index 98d81ac..744a653 100644 --- a/app/main.py +++ b/app/main.py @@ -78,6 +78,7 @@ def admin(): @app.before_first_request def activate_job(): + helpers.create_data_directory() database.create_entry_table() database.create_song_table() database.create_list_view()