From 63f9c19b517bbfd60ce105b832ee6a1455c8eb2b Mon Sep 17 00:00:00 2001 From: Shashank Verma Date: Wed, 4 Oct 2023 10:29:54 +0530 Subject: [PATCH] contrihub: urls: Change base url if mentioned in env Signed-off-by: Shashank Verma --- contrihub/urls.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contrihub/urls.py b/contrihub/urls.py index 2ea180a..e4f6e18 100644 --- a/contrihub/urls.py +++ b/contrihub/urls.py @@ -13,11 +13,14 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ +from decouple import config from django.contrib import admin # from django.conf.urls import from django.urls import path, include, re_path -urlpatterns = [ +BASE_URL = config('BASE_URL', default=None) + +basepatterns = [ path('admin/', admin.site.urls), path('', include('home.urls')), path('profile/', include('user_profile.urls')), @@ -26,3 +29,10 @@ # this url is handled by social_django app under social-auth-app-django python library re_path(r'^oauth/', include('social_django.urls', namespace='social')), ] + +if BASE_URL: + urlpatterns = [ + path(str(BASE_URL), include(basepatterns)) + ] +else: + urlpatterns = basepatterns