13ee8a148ecbf9519e057da24e4900da9a29a5a5
[chloro.git] / chloro / settings.py
1 """
2 Django settings for chloro project.
3
4 Generated by 'django-admin startproject' using Django 1.11.17.
5
6 For more information on this file, see
7 https://docs.djangoproject.com/en/1.11/topics/settings/
8
9 For the full list of settings and their values, see
10 https://docs.djangoproject.com/en/1.11/ref/settings/
11 """
12
13 import copy
14 import os
15
16 from django.conf import global_settings
17
18 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
19 BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
20
21
22 # Quick-start development settings - unsuitable for production
23 # See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
24
25 # SECURITY WARNING: keep the secret key used in production secret!
26 SECRET_KEY = ''
27
28 # SECURITY WARNING: don't run with debug turned on in production!
29 DEBUG = True
30
31 ALLOWED_HOSTS = []
32
33
34 # Application definition
35
36 INSTALLED_APPS = [
37     'django.contrib.auth',
38     'django.contrib.contenttypes',
39     'django.contrib.sessions',
40     'django.contrib.messages',
41     'django.contrib.staticfiles',
42     'ckeditor',
43     'gadjo',
44     'taggit',
45     'chloro.phyll',
46 ]
47
48 MIDDLEWARE = [
49     'django.middleware.security.SecurityMiddleware',
50     'django.contrib.sessions.middleware.SessionMiddleware',
51     'django.middleware.common.CommonMiddleware',
52     'django.middleware.csrf.CsrfViewMiddleware',
53     'django.contrib.auth.middleware.AuthenticationMiddleware',
54     'django.contrib.messages.middleware.MessageMiddleware',
55     'django.middleware.clickjacking.XFrameOptionsMiddleware',
56 ]
57
58 ROOT_URLCONF = 'chloro.urls'
59
60 TEMPLATES = [
61     {
62         'BACKEND': 'django.template.backends.django.DjangoTemplates',
63         'DIRS': [],
64         'APP_DIRS': True,
65         'OPTIONS': {
66             'context_processors': [
67                 'django.template.context_processors.debug',
68                 'django.template.context_processors.request',
69                 'django.contrib.auth.context_processors.auth',
70                 'django.contrib.messages.context_processors.messages',
71             ],
72         },
73     },
74 ]
75
76 WSGI_APPLICATION = 'chloro.wsgi.application'
77
78
79 # Database
80 # https://docs.djangoproject.com/en/1.11/ref/settings/#databases
81
82 DATABASES = {
83     'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'chloro',},
84 }
85
86
87 # Password validation
88 # https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
89
90 AUTH_PASSWORD_VALIDATORS = [
91     {'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',},
92     {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',},
93     {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',},
94     {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',},
95 ]
96
97 LOGIN_REDIRECT_URL = '/'
98 LOGIN_URL = 'login'
99
100 # Internationalization
101 # https://docs.djangoproject.com/en/1.11/topics/i18n/
102
103 LANGUAGE_CODE = 'fr-be'
104
105 TIME_ZONE = 'Europe/Brussels'
106
107 USE_I18N = True
108
109 USE_L10N = True
110
111 USE_TZ = True
112
113
114 # Static files (CSS, JavaScript, Images)
115 # https://docs.djangoproject.com/en/1.11/howto/static-files/
116 STATIC_ROOT = os.path.join(BASE_DIR, 'collected-static')
117 STATIC_URL = '/static/'
118 STATICFILES_FINDERS = list(global_settings.STATICFILES_FINDERS) + ['gadjo.finders.XStaticFinder']
119
120 # Media files
121 MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
122 MEDIA_URL = '/media/'
123
124 # ckeditor
125 CKEDITOR_UPLOAD_PATH = 'uploads/'
126 CKEDITOR_IMAGE_BACKEND = 'pillow'
127
128 CKEDITOR_CONFIGS = {
129     'default': {
130         'allowedContent': True,
131         'removePlugins': 'stylesheetparser',
132         'toolbar_Own': [
133             ['Source', 'Format', '-', 'Bold', 'Italic'],
134             ['NumberedList', 'BulletedList'],
135             ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'],
136             ['Link', 'Unlink'],
137             ['Image', '-', 'HorizontalRule'],
138             ['RemoveFormat',],
139             ['Maximize'],
140         ],
141         'toolbar': 'Own',
142         'resize_enabled': False,
143         'height': 500,
144     },
145 }
146
147 SITE_AUTHOR = "Frédéric Péters"
148 SITE_TITLE = "Coin web de Frédéric Péters"
149
150 local_settings_file = os.environ.get(
151     'CHLORO_SETTINGS_FILE', os.path.join(os.path.dirname(__file__), 'local_settings.py')
152 )
153 if os.path.exists(local_settings_file):
154     exec(open(local_settings_file).read())
155
156 assert SECRET_KEY