mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-06 03:05:35 +00:00

+ add route to get all settings + add route to set any setting + add untested migration to add settings into settings db + compress json in api responses using FlaskCompress + serve gziped assets if browser accepts encoded files + misc
29 lines
714 B
Python
29 lines
714 B
Python
"""
|
|
Prepares the server for use.
|
|
"""
|
|
from app.db.sqlite.settings import load_settings
|
|
from app.setup.files import create_config_dir
|
|
from app.setup.sqlite import run_migrations, setup_sqlite
|
|
from app.store.albums import AlbumStore
|
|
from app.store.artists import ArtistStore
|
|
from app.store.tracks import TrackStore
|
|
from app.utils.generators import get_random_str
|
|
|
|
|
|
def run_setup():
|
|
create_config_dir()
|
|
setup_sqlite()
|
|
run_migrations()
|
|
|
|
try:
|
|
load_settings()
|
|
except IndexError:
|
|
# settings table is empty
|
|
pass
|
|
|
|
instance_key = get_random_str()
|
|
|
|
TrackStore.load_all_tracks(instance_key)
|
|
AlbumStore.load_albums(instance_key)
|
|
ArtistStore.load_artists(instance_key)
|