mirror of
https://github.com/sissbruecker/linkding.git
synced 2025-08-13 21:49:26 +02:00
Add support for context path (#313)
* Add support for context path add an optional environment variable: LD_CONTEXT_PATH * Fix for pull request code review comments Co-authored-by: s2marine <s2marine@gmail.com>
This commit is contained in:
@@ -107,9 +107,12 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
},
|
||||
]
|
||||
|
||||
LOGIN_URL = '/login'
|
||||
LOGIN_REDIRECT_URL = '/bookmarks'
|
||||
LOGOUT_REDIRECT_URL = '/login'
|
||||
# Website context path.
|
||||
LD_CONTEXT_PATH = os.getenv('LD_CONTEXT_PATH', '')
|
||||
|
||||
LOGIN_URL = '/' + LD_CONTEXT_PATH + 'login'
|
||||
LOGIN_REDIRECT_URL = '/' + LD_CONTEXT_PATH + 'bookmarks'
|
||||
LOGOUT_REDIRECT_URL = '/' + LD_CONTEXT_PATH + 'login'
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
@@ -127,7 +130,7 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_URL = '/' + LD_CONTEXT_PATH + 'static/'
|
||||
|
||||
# Collect static files in static folder
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
|
||||
|
@@ -13,6 +13,7 @@ Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.urls import path, include
|
||||
|
||||
@@ -30,6 +31,9 @@ urlpatterns = [
|
||||
path('', include('bookmarks.urls')),
|
||||
]
|
||||
|
||||
if settings.LD_CONTEXT_PATH:
|
||||
urlpatterns = [path(settings.LD_CONTEXT_PATH, include(urlpatterns))]
|
||||
|
||||
if DEBUG:
|
||||
import debug_toolbar
|
||||
|
||||
|
Reference in New Issue
Block a user