Fix relative path
This commit is contained in:
parent
84c738632b
commit
994c74b136
@ -1,2 +1,2 @@
|
|||||||
MUSIC_DIR=/root/tunedrop/backend/music
|
MUSIC_DIR=music/
|
||||||
NAVIDROME_SCAN_URL=
|
NAVIDROME_SCAN_URL=
|
||||||
Binary file not shown.
@ -4,7 +4,15 @@ from dotenv import load_dotenv
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
MUSIC_DIR = os.getenv("MUSIC_DIR", "/root/tunedrop/backend/music")
|
# If MUSIC_DIR is not absolute, make it relative to the project root
|
||||||
|
_music_dir = os.getenv("MUSIC_DIR", "music")
|
||||||
|
if not os.path.isabs(_music_dir):
|
||||||
|
# Use the directory where config.py is located as the base
|
||||||
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
MUSIC_DIR = os.path.abspath(os.path.join(BASE_DIR, _music_dir))
|
||||||
|
else:
|
||||||
|
MUSIC_DIR = _music_dir
|
||||||
|
|
||||||
NAVIDROME_SCAN_URL = os.getenv("NAVIDROME_SCAN_URL", "")
|
NAVIDROME_SCAN_URL = os.getenv("NAVIDROME_SCAN_URL", "")
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
Loading…
x
Reference in New Issue
Block a user