From 304cc153cfef5a9812c73813b3744e76ddd0e1ec Mon Sep 17 00:00:00 2001 From: meeb Date: Sat, 19 Dec 2020 18:10:10 +1100 Subject: [PATCH] add DJANGO_FORCE_SCRIPT_NAME env var to change Djangos FORCE_SCRIPT_NAME if needed, part of support for running TubeSync in a /suburi and not a domain root, resolves #18 --- README.md | 17 +++++++++-------- tubesync/tubesync/local_settings.py.container | 1 + tubesync/tubesync/settings.py | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 197a14d..4ed9abc 100644 --- a/README.md +++ b/README.md @@ -297,14 +297,15 @@ There are a number of other environment variables you can set. These are, mostly **NOT** required to be set in the default container installation, they are really only useful if you are manually installing TubeSync in some other environment. These are: -| Name | What | Example | -| ----------------- | ------------------------------------- | ---------------------------------- | -| DJANGO_SECRET_KEY | Django secret key | YJySXnQLB7UVZw2dXKDWxI5lEZaImK6l | -| TUBESYNC_DEBUG | Enable debugging | True | -| TUBESYNC_HOSTS | Django's ALLOWED_HOSTS | tubesync.example.com,otherhost.com | -| GUNICORN_WORKERS | Number of gunicorn workers to spawn | 3 | -| LISTEN_HOST | IP address for gunicorn to listen on | 127.0.0.1 | -| LISTEN_PORT | Port number for gunicorn to listen on | 8080 | +| Name | What | Example | +| ------------------------ | ------------------------------------- | ---------------------------------- | +| DJANGO_SECRET_KEY | Django's SECRET_KEY | YJySXnQLB7UVZw2dXKDWxI5lEZaImK6l | +| DJANGO_FORCE_SCRIPT_NAME | Django's FORCE_SCRIPT_NAME | /somepath | +| TUBESYNC_DEBUG | Enable debugging | True | +| TUBESYNC_HOSTS | Django's ALLOWED_HOSTS | tubesync.example.com,otherhost.com | +| GUNICORN_WORKERS | Number of gunicorn workers to spawn | 3 | +| LISTEN_HOST | IP address for gunicorn to listen on | 127.0.0.1 | +| LISTEN_PORT | Port number for gunicorn to listen on | 8080 | # Manual, non-containerised, installation diff --git a/tubesync/tubesync/local_settings.py.container b/tubesync/tubesync/local_settings.py.container index 66bc437..9a61395 100644 --- a/tubesync/tubesync/local_settings.py.container +++ b/tubesync/tubesync/local_settings.py.container @@ -15,6 +15,7 @@ SECRET_KEY = str(os.getenv('DJANGO_SECRET_KEY', 'tubesync-django-secret')) ALLOWED_HOSTS_STR = str(os.getenv('TUBESYNC_HOSTS', '127.0.0.1,localhost')) ALLOWED_HOSTS = ALLOWED_HOSTS_STR.split(',') DEBUG = True if os.getenv('TUBESYNC_DEBUG', False) else False +FORCE_SCRIPT_NAME = os.getenv('DJANGO_FORCE_SCRIPT_NAME', None) TIME_ZONE = os.getenv('TZ', 'UTC') diff --git a/tubesync/tubesync/settings.py b/tubesync/tubesync/settings.py index c423f6e..45a97e1 100644 --- a/tubesync/tubesync/settings.py +++ b/tubesync/tubesync/settings.py @@ -41,6 +41,7 @@ MIDDLEWARE = [ ROOT_URLCONF = 'tubesync.urls' +FORCE_SCRIPT_NAME = None TEMPLATES = [