Commit da86e0d8 by Bach Dániel

circle: disable django admin in production

Closes #369
parent 1e514d5b
...@@ -559,3 +559,5 @@ MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024) ...@@ -559,3 +559,5 @@ MAX_NODE_RAM = get_env_variable("MAX_NODE_RAM", 1024)
# Url to download the client: (e.g. http://circlecloud.org/client/download/) # Url to download the client: (e.g. http://circlecloud.org/client/download/)
CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/') CLIENT_DOWNLOAD_URL = get_env_variable('CLIENT_DOWNLOAD_URL', 'http://circlecloud.org/client/download/')
ADMIN_ENABLED = False
...@@ -113,3 +113,5 @@ if DEBUG: ...@@ -113,3 +113,5 @@ if DEBUG:
PIPELINE_DISABLED_COMPILERS = ( PIPELINE_DISABLED_COMPILERS = (
'pipeline.compilers.less.LessCompiler', 'pipeline.compilers.less.LessCompiler',
) )
ADMIN_ENABLED = True
...@@ -41,7 +41,6 @@ urlpatterns = patterns( ...@@ -41,7 +41,6 @@ urlpatterns = patterns(
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^$', lambda x: redirect(reverse("dashboard.index"))), url(r'^$', lambda x: redirect(reverse("dashboard.index"))),
url(r'^admin/', include(admin.site.urls)),
url(r'^network/', include('network.urls')), url(r'^network/', include('network.urls')),
url(r'^dashboard/', include('dashboard.urls')), url(r'^dashboard/', include('dashboard.urls')),
...@@ -79,6 +78,12 @@ if 'rosetta' in settings.INSTALLED_APPS: ...@@ -79,6 +78,12 @@ if 'rosetta' in settings.INSTALLED_APPS:
url(r'^rosetta/', include('rosetta.urls')), url(r'^rosetta/', include('rosetta.urls')),
) )
if settings.ADMIN_ENABLED:
urlpatterns += patterns(
'',
url(r'^admin/', include(admin.site.urls)),
)
if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE': if get_env_variable('DJANGO_SAML', 'FALSE') == 'TRUE':
urlpatterns += patterns( urlpatterns += patterns(
......
...@@ -29,4 +29,5 @@ def notifications(request): ...@@ -29,4 +29,5 @@ def notifications(request):
def extract_settings(request): def extract_settings(request):
return { return {
'COMPANY_NAME': getattr(settings, "COMPANY_NAME", None), 'COMPANY_NAME': getattr(settings, "COMPANY_NAME", None),
'ADMIN_ENABLED': getattr(settings, "ADMIN_ENABLED", False),
} }
...@@ -20,9 +20,11 @@ ...@@ -20,9 +20,11 @@
{% if user.is_authenticated and user.pk and not request.token_user %} {% if user.is_authenticated and user.pk and not request.token_user %}
<ul class="nav navbar-nav navbar-right" id="dashboard-menu"> <ul class="nav navbar-nav navbar-right" id="dashboard-menu">
{% if user.is_superuser %} {% if user.is_superuser %}
{% if ADMIN_ENABLED %}
<li> <li>
<a href="/admin/"><i class="fa fa-cogs"></i> {% trans "Admin" %}</a> <a href="/admin/"><i class="fa fa-cogs"></i> {% trans "Admin" %}</a>
</li> </li>
{% endif %}
<li> <li>
<a href="/network/"><i class="fa fa-globe"></i> {% trans "Network" %}</a> <a href="/network/"><i class="fa fa-globe"></i> {% trans "Network" %}</a>
</li> </li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment