Skip to content

Instantly share code, notes, and snippets.

@Jwpe
Created May 19, 2014 05:24
Show Gist options
  • Save Jwpe/631413ac7a4a4c645a94 to your computer and use it in GitHub Desktop.
Save Jwpe/631413ac7a4a4c645a94 to your computer and use it in GitHub Desktop.
Use a random URL path for the Django admin interface
from django.conf import settings
from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
# Tells the admin to discover any 'admin.py' files in your apps. Not necessary in Django 1.7+
admin.autodiscover()
urlpatterns = patterns('',
url(r'^{}/admin/'.format(settings.ADMIN_URL_PATH), include(admin.site.urls)),
...
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment