Commit f8800d8e authored by Vincent Le gallic's avatar Vincent Le gallic

L'intranet est plus facile à utiliser out of the box

parent 7d8c1062
Pour faire marcher l'intranet :
* passer DEV à True dans settings.py
* changer la ligne MAIN_PATH = '/home/toto/Crans/' dans settings.py
* exécuter ./manage.py syncdb
......@@ -6,6 +6,7 @@ import sys
sys.path.append("/etc/crans/secrets")
DEBUG = True
DEV = True
TEMPLATE_DEBUG = DEBUG
EMAIL_SUBJECT_PREFIX = "[Intranet2 Cr@ns] "
......@@ -17,14 +18,20 @@ ADMINS = (
MANAGERS = ADMINS
ROOT_PATH='/localhome/django/intranet/'
DB_PATH='/localhome/django/local_db/'
if DEV:
MAIN_PATH = '/home/toto/Crans/'
DB_PATH = MAIN_PATH + 'intranet/default_db.sqlite'
else:
MAIN_PATH = '/localhome/django/'
DB_PATH = MAIN_PATH + 'local_dl/default'
ROOT_PATH = MAIN_PATH + 'intranet/'
FIXTURE_DIRS=(ROOT_PATH + 'fixtures/',)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': DB_PATH + 'default',
'NAME': DB_PATH,
},
}
......@@ -102,7 +109,7 @@ LOGIN_URL = "/login"
LOGIN_REDIRECT_URL = "/"
AUTHENTICATION_BACKENDS = (
# 'intranet.login.LDAPUserBackend',
'intranet.login.LDAPUserBackend',
'django.contrib.auth.backends.ModelBackend',
)
......
......@@ -9,15 +9,27 @@ from utils.protectpost import protect
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Les pages existantes
url('^$', 'intranet.accueil.view'),
# 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)),
)
# 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)),
)
for app in settings.INTRANET_APPS:
app = app["name"]
......
......@@ -15,5 +15,5 @@ def protect(f):
except Exception as e:
if not settings.DEBUG:
request.POST = "Censuré (mettre settings.DEBUG=True si voulu)"
raise e
raise
return wrapper
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