From dc89cb1a5d3f755a0ba16739025e87ef543a0e4a Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Mon, 21 May 2018 20:58:51 +0200 Subject: [PATCH 1/2] add possibility to set static url path from environment variable fix #24 --- webtodotxt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webtodotxt.py b/webtodotxt.py index c260469..584935f 100644 --- a/webtodotxt.py +++ b/webtodotxt.py @@ -3,13 +3,15 @@ from flask_babel import Babel from flask import Flask import logging +import os # ----------------------------------------------------------- # Boot +STATIC_URL_PATH = os.getenv('WEBTODOTXT_STATIC_URL_PATH', '') -app = Flask(__name__, static_url_path='') +app = Flask(__name__, static_url_path=STATIC_URL_PATH) app.config.from_pyfile('config.py') if not app.config['TITLE']: From d9ec7ac1528bea0c21487eb0017b35e315238237 Mon Sep 17 00:00:00 2001 From: Sven Fischer Date: Mon, 21 May 2018 21:07:07 +0200 Subject: [PATCH 2/2] add option to override ROOT_URL This commit adds the option to override the ROOT_URL with a value from an environment variable WEBTODOTXT_FORCE_ROOT_URL. It is necessary if you are using an nginx as frontend and pass the request as proxy to the docker container - especially when you want to deploy webtodotxt in a subdirectory. fix #24 --- routes.py | 4 +++- templates/app.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/routes.py b/routes.py index 896a1a3..46dca62 100644 --- a/routes.py +++ b/routes.py @@ -3,14 +3,16 @@ from webtodotxt import app, auth from helpers import * import todotxtio +import os @app.route('/') @auth.login_required def home(): locale = get_locale() + FORCE_ROOT_URL = os.getenv('WEBTODOTXT_FORCE_ROOT_URL', None) - return render_template('app.html', first_week_day=locale.first_week_day + 1) + return render_template('app.html', first_week_day=locale.first_week_day + 1, force_root_url=FORCE_ROOT_URL) @app.route('/todo.txt', methods=['GET', 'POST']) diff --git a/templates/app.html b/templates/app.html index c595afc..9a983a6 100644 --- a/templates/app.html +++ b/templates/app.html @@ -145,7 +145,7 @@

{{ _('Contexts') }}