From e5848eecf57f99dadb7c6ebef7045ef851ba808a Mon Sep 17 00:00:00 2001 From: Fluffy-Bean Date: Sat, 11 Mar 2023 23:56:48 +0000 Subject: [PATCH] Fix files not being created on clean installation --- README.md | 16 +++++++++++++--- gallery/setup.py | 4 ++-- gallery/theme_manager.py | 5 ++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a03f00c..874dc54 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,10 @@ ### Currently implemented - Easy uploading and managing of a gallery of images - Multi user support, helping you manage a whole group of photographers +- Image groups, helping you sort your favorite memories - Custom CSS support ### Coming soon tm -- Image groups, helping you sort your favorite memories - Password locked images/image groups, helping you share photos only to those who you want to - Logging and automatic login attempt warnings and timeouts - Searching through tags, file names, users (and metadata maybe, no promises) @@ -44,8 +44,18 @@ Image view ## Running By default, the app runs on port 5000 with 4 workers, you can pass in arguments to change that, use `-h` or `--help` to see all the options. -Once you clone the repo to your desired location and have installed python `poetry`, install the requirements with `poetry install`. From there you can run the app with Gunicorn using `poetry run python3 run.py`! +Once you clone the repo to your desired location and have installed python `poetry`, install the requirements with the following command: -You can also run the app in debug mode using `-d` or `--debug`, but its best to look into the logs file located under `~/.config/onlylegs/only.log` + poetry install + +From there you can run the app with Gunicorn using: + + poetry run python3 run.py + +You can also run the app in debug mode using `-d` or `--debug`, but its best to look into the logs file located under `~/.config/onlylegs/only.log` if you're facing issues of any sorts! + +On some systems, especially containers, you may need to set an XDG path for configuration files, you can do this with + + export XDG_CONFIG_HOME="$HOME/.config" Enjoy using OnlyLegs! \ No newline at end of file diff --git a/gallery/setup.py b/gallery/setup.py index 9d28abd..af342f4 100644 --- a/gallery/setup.py +++ b/gallery/setup.py @@ -61,7 +61,7 @@ class SetupApp: 'FLASK_SECRETE': 'dev', } try: - with open(os.path.join(USER_DIR, '.env'), encoding='utf-8') as file: + with open(os.path.join(USER_DIR, '.env'), encoding='utf-8', mode='w+') as file: for key, value in env_conf.items(): file.write(f"{key}={value}\n") print("Created environment variables") @@ -103,7 +103,7 @@ class SetupApp: }, } try: - with open(os.path.join(USER_DIR, 'conf.yml'), encoding='utf-8') as file: + with open(os.path.join(USER_DIR, 'conf.yml'), encoding='utf-8', mode='w+') as file: yaml.dump(yaml_conf, file, default_flow_style=False) print("Created default gallery config") except Exception as err: diff --git a/gallery/theme_manager.py b/gallery/theme_manager.py index f62225e..f8fb22a 100644 --- a/gallery/theme_manager.py +++ b/gallery/theme_manager.py @@ -45,8 +45,11 @@ class CompileTheme: else: print("No sass file found!") sys.exit(1) + + if not os.path.exists(css_dest): + os.makedirs(css_dest) - with open(os.path.join(css_dest, 'style.css'), 'w', encoding='utf-8') as file: + with open(os.path.join(css_dest, 'style.css'), encoding='utf-8', mode='w+') as file: try: file.write(sass.compile(filename=sass_path,output_style='compressed')) except sass.CompileError as err: