1
Fork 0

use seperate setting for disabling admin

This commit is contained in:
Jake Howard 2016-11-27 22:10:28 +00:00
parent 132464b35f
commit a316eb928b
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 5 additions and 3 deletions

View file

@ -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!

View file

@ -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)