settings.py 4.55 KB
Newer Older
1
# -*- mode: python; coding: utf-8 -*-
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# Re2o est un logiciel d'administration développé initiallement au rezometz. Il
# se veut agnostique au réseau considéré, de manière à être installable en
# quelques clics.
#
# Copyright © 2017  Gabriel Détraz
# Copyright © 2017  Goulven Kermarec
# Copyright © 2017  Augustin Lemesle
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

chirac's avatar
chirac committed
24 25 26 27 28 29 30 31 32 33 34 35
"""
Django settings for re2o project.

Generated by 'django-admin startproject' using Django 1.8.13.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""

36 37
from __future__ import unicode_literals

chirac's avatar
chirac committed
38 39
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
Gabriel Detraz's avatar
Gabriel Detraz committed
40
from .settings_local import *
chirac's avatar
chirac committed
41 42 43 44 45 46 47

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/

48 49 50 51 52 53 54
# Auth definition

PASSWORD_HASHERS = (
    're2o.login.SSHAPasswordHasher',
    'django.contrib.auth.hashers.PBKDF2PasswordHasher',
)

55
AUTH_USER_MODEL = 'users.User'
56
LOGIN_URL = '/login/'
lhark's avatar
lhark committed
57
LOGIN_REDIRECT_URL = '/'
58

59

chirac's avatar
chirac committed
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'bootstrap3',
    'users',
    'machines',
    'cotisations',
    'topologie',
    'search',
chirac's avatar
chirac committed
75
    're2o',
76
    'preferences',
chirac's avatar
chirac committed
77
    'logs',
chirac's avatar
chirac committed
78 79
    'rest_framework',
    'reversion'
80
) + OPTIONNAL_APPS
chirac's avatar
chirac committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 're2o.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
                os.path.join(BASE_DIR, 'templates').replace('\\', '/'),
            ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
108
                'django.template.context_processors.request',
109
                're2o.context_processors.context_user',
chirac's avatar
chirac committed
110 111 112 113 114 115 116 117 118 119 120
            ],
        },
    },
]

WSGI_APPLICATION = 're2o.wsgi.application'


# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/

121
LANGUAGE_CODE = 'fr-fr'
chirac's avatar
chirac committed
122

123
TIME_ZONE = 'Europe/Paris'
chirac's avatar
chirac committed
124 125 126 127 128 129 130

USE_I18N = True

USE_L10N = True

USE_TZ = True

131 132
DATABASE_ROUTERS = ['ldapdb.router.Router']

chirac's avatar
chirac committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152

# django-bootstrap3 config dictionnary
BOOTSTRAP3 = {
            'jquery_url': '/static/js/jquery-2.2.4.min.js',
            'base_url': '/static/bootstrap/',
            'include_jquery': True,
        }

BOOTSTRAP_BASE_URL = '/static/bootstrap/'

STATICFILES_DIRS = (
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
    os.path.join(
        BASE_DIR,
        'static',
    ),
)

153 154
MEDIA_ROOT = '/var/www/re2o/static'

chirac's avatar
chirac committed
155
STATIC_URL = '/static/'
156

157
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
158 159

RIGHTS_LINK = {
160
    'cableur' : ['bureau','infra','bofh','trésorier'],
161 162 163
    'bofh' : ['bureau','trésorier'],
    }

164 165 166 167
GRAPH_MODELS = {
  'all_applications': True,
  'group_models': True,
}