Skip to content

Commit

Permalink
Add ability to have configurable Django admin path (#2666)
Browse files Browse the repository at this point in the history
* add ability to have configurable Django admin path

* address lint warning consider-using-f-string

* remove extra slash from default admin url
  • Loading branch information
kelvin-muchiri authored Aug 26, 2024
1 parent 085b54e commit 4b8ef74
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions onadata/apps/main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from onadata.libs.utils.analytics import init_analytics

TESTING = len(sys.argv) > 1 and sys.argv[1] == "test"
ADMIN_URL_PATH = getattr(settings, "ADMIN_URL_PATH", "admin")

admin.autodiscover()

Expand All @@ -50,8 +51,8 @@
re_path(r"^api/v1$", RedirectView.as_view(url="/api/v1/", permanent=True)),
# django default stuff
re_path(r"^accounts/", include(registration_patterns)),
re_path(r"^admin/", admin.site.urls),
re_path(r"^admin/doc/", include("django.contrib.admindocs.urls")),
re_path(f"^{ADMIN_URL_PATH}/", admin.site.urls),
re_path(f"^{ADMIN_URL_PATH}/doc/", include("django.contrib.admindocs.urls")),
# oath2_provider
re_path(
r"^o/authorize/$",
Expand Down

0 comments on commit 4b8ef74

Please sign in to comment.