use seperate setting for disabling admin
This commit is contained in:
parent
132464b35f
commit
a316eb928b
2 changed files with 5 additions and 3 deletions
|
@ -7,6 +7,7 @@ ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = os.environ['DEBUG']
|
DEBUG = os.environ['DEBUG']
|
||||||
|
ENABLE_ADMIN = DEBUG
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = os.environ['SECRET_KEY']
|
SECRET_KEY = os.environ['SECRET_KEY']
|
||||||
|
@ -47,7 +48,7 @@ INSTALLED_APPS = [
|
||||||
'project.search',
|
'project.search',
|
||||||
]
|
]
|
||||||
|
|
||||||
if DEBUG:
|
if ENABLE_ADMIN:
|
||||||
INSTALLED_APPS += ['django.contrib.admin']
|
INSTALLED_APPS += ['django.contrib.admin']
|
||||||
|
|
||||||
# Harden Django!
|
# Harden Django!
|
||||||
|
|
|
@ -16,13 +16,14 @@ urlpatterns = [
|
||||||
url(r'', include(wagtail_urls)),
|
url(r'', include(wagtail_urls)),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if settings.ENABLE_ADMIN:
|
||||||
|
urlpatterns = [url(r'^django-admin/', include(admin.site.urls))] + urlpatterns
|
||||||
|
|
||||||
|
|
||||||
if settings.DEBUG:
|
if settings.DEBUG:
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
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
|
# Serve static and media files from development server
|
||||||
urlpatterns += staticfiles_urlpatterns()
|
urlpatterns += staticfiles_urlpatterns()
|
||||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
|
Reference in a new issue