Skip to content

Commit

Permalink
Add setting ADMIN_URL to customise location of site admin
Browse files Browse the repository at this point in the history
For RFDS the site admin is under /rfds-admin/ not /admin/. The new
ADMIN_URL setting makes the admin URL prefix easily configurable in
downstream projects without needing to mess with URL patterns.
  • Loading branch information
jmurty authored and mrmachine committed Aug 18, 2020
1 parent e75fec5 commit ee32858
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ixc_django_docker/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
MEDIA_ROOT = os.path.join(VAR_DIR, 'media_root')
MEDIA_URL = '/media/'

# Prefix for admin URL paths, see `ixc_django_docker.urls`
ADMIN_URL = '/admin/'

#
# HTTPS
#
Expand Down
5 changes: 3 additions & 2 deletions ixc_django_docker/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

# Django Admin.
if 'django.contrib.admin' in settings.INSTALLED_APPS:
_prefix = settings.ADMIN_URL.strip("/")
urlpatterns += [
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^%s/doc/' % _prefix, include('django.contrib.admindocs.urls')),
url(r'^%s/' % _prefix, include(admin.site.urls)),
]

# Django Auth.
Expand Down

0 comments on commit ee32858

Please sign in to comment.