Maintaining a Django admin site on a subdomain

I have a project running Django, uWSGI and Nginx. I am currently using the default Django admin site which runs in

. I want to change this so that the admin site is only accessible in


What's the best way to do this?

I thought about starting a completely new Django project that will be served on

, but with the same database settings as the project that is running

, but I'm hoping for something more elegant as it involves duplicating a lot of settings and applications between projects. Basically, the only difference between the two would be that it would have an admin site and URL pattern set, and one wouldn't.

(My reason is that you end up wanting to use something like google auth proxy to secure the admin site, but skip the no admin login, how can I do this by specifying that Django uses HTTP Basic Auth for

, but stick to the default backend for



source to share

1 answer

Just create a new settings file that includes the original settings and defines a custom parameter ROOT_URLCONF

. Now you just need to deploy the application with this DJANGO_SETTINGS_MODULE

in this admin subdomain.


from settings import *
ROOT_URLCONF = 'urls_admin'

from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
    url(r'', include(,




All Articles