Commit 470d8f0c authored by Vincent Le gallic's avatar Vincent Le gallic

urlpatterns différencié entre DEV et non-DEV de manière plus propre. (et accessoirement, DEV=False)

parent f8800d8e
......@@ -6,7 +6,7 @@ import sys
sys.path.append("/etc/crans/secrets")
DEBUG = True
DEV = True
DEV = False
TEMPLATE_DEBUG = DEBUG
EMAIL_SUBJECT_PREFIX = "[Intranet2 Cr@ns] "
......
......@@ -9,27 +9,21 @@ from utils.protectpost import protect
from django.contrib import admin
admin.autodiscover()
# Oui, c'est un peu sale, mais en DEV on veut que django serve les fichiers statiques
if settings.DEV:
urlpatterns = patterns('',
# Les pages existantes
url('^$', 'intranet.accueil.view'),
# Pages de login
url('^login', protect(django.contrib.auth.views.login), {'template_name': 'login.html'}, name="login"),
url('^logout', 'django.contrib.auth.views.logout_then_login', name ="logout"),
url('^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':'static/'}),
(r'^admin/', include(admin.site.urls)),
)
else:
urlpatterns = patterns('',
# Les pages existantes
url('^$', 'intranet.accueil.view'),
# Pages de login
url('^login', protect(django.contrib.auth.views.login), {'template_name': 'login.html'}, name="login"),
url('^logout', 'django.contrib.auth.views.logout_then_login', name ="logout"),
(r'^admin/', include(admin.site.urls)),
urlpatterns = patterns(''
# Les pages existantes
url('^$', 'intranet.accueil.view'),
# Pages de login
url('^login', protect(django.contrib.auth.views.login), {'template_name': 'login.html'}, name="login"),
url('^logout', 'django.contrib.auth.views.logout_then_login', name ="logout"),
(r'^admin/', include(admin.site.urls)),
)
if settings.DEV:
# Quand on utilise le serveur de DEV, on veut que Django serve les static files
urlpatterns += patterns('', url('^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root':'static/'}),
)
for app in settings.INTRANET_APPS:
app = app["name"]
......
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 to comment