From 546b5b2f6f872754329ae5de0b182f6e63555fb9 Mon Sep 17 00:00:00 2001 From: n9k Date: Sun, 20 Feb 2022 04:42:24 +0000 Subject: [PATCH] Always use config.toml in same directory as app.py --- anonstream/__init__.py | 4 ++-- app.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/anonstream/__init__.py b/anonstream/__init__.py index b42b3bd..69373ff 100644 --- a/anonstream/__init__.py +++ b/anonstream/__init__.py @@ -10,8 +10,8 @@ from anonstream.utils.captcha import create_captcha_factory, create_captcha_sign from anonstream.utils.colour import color_to_colour from anonstream.utils.user import generate_token -def create_app(): - with open('config.toml') as fp: +def create_app(config_file): + with open(config_file) as fp: config = toml.load(fp) auth_password = secrets.token_urlsafe(6) diff --git a/app.py b/app.py index 33a34d3..6390963 100644 --- a/app.py +++ b/app.py @@ -1,6 +1,8 @@ +import os import anonstream -app = anonstream.create_app() +config_file = os.path.join(os.path.dirname(__file__), 'config.toml') +app = anonstream.create_app(config_file) if __name__ == '__main__': app.run(port=5051, debug=True)