diff --git a/project/settings.py b/project/settings.py index 60ed455..7af97a3 100755 --- a/project/settings.py +++ b/project/settings.py @@ -7,6 +7,7 @@ ALLOWED_HOSTS = ['*'] # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.environ['DEBUG'] +ENABLE_ADMIN = DEBUG # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.environ['SECRET_KEY'] @@ -47,7 +48,7 @@ INSTALLED_APPS = [ 'project.search', ] -if DEBUG: +if ENABLE_ADMIN: INSTALLED_APPS += ['django.contrib.admin'] # Harden Django! diff --git a/project/urls.py b/project/urls.py index a907951..cdbddd2 100755 --- a/project/urls.py +++ b/project/urls.py @@ -16,13 +16,14 @@ urlpatterns = [ url(r'', include(wagtail_urls)), ] +if settings.ENABLE_ADMIN: + urlpatterns = [url(r'^django-admin/', include(admin.site.urls))] + urlpatterns + if settings.DEBUG: from django.conf.urls.static import static from django.contrib.staticfiles.urls import staticfiles_urlpatterns - urlpatterns = [url(r'^django-admin/', include(admin.site.urls))] + urlpatterns - # Serve static and media files from development server urlpatterns += staticfiles_urlpatterns() urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)