990975479e93b990c0a0cf9cffb0a88d6f14a3dd
[redakcja.git] / src / redakcja / settings / __init__.py
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3 import os.path
4 from .defaults import *
5 from ..localsettings import *
6 import os
7
8 PROJECT_ROOT = os.path.realpath(os.path.dirname(os.path.dirname(__file__)))
9
10 STATICFILES_DIRS = [
11     PROJECT_ROOT + '/static/'
12 ]
13
14 TEMPLATES = [
15     {
16         'BACKEND': 'django.template.backends.django.DjangoTemplates',
17         'APP_DIRS': True,
18         'DIRS': [
19             PROJECT_ROOT + '/templates',
20         ],
21         'OPTIONS': {
22             'context_processors': [
23                 "django.contrib.auth.context_processors.auth",
24                 "django.template.context_processors.debug",
25                 "django.template.context_processors.i18n",
26                 "redakcja.context_processors.settings", # this is instead of media
27                 'django.template.context_processors.csrf',
28                 "django.template.context_processors.request",
29             ],
30         },
31     },
32 ]
33
34 MIDDLEWARE_CLASSES = (
35     'django.middleware.common.CommonMiddleware',
36     'django.middleware.csrf.CsrfViewMiddleware',
37     'django.contrib.sessions.middleware.SessionMiddleware',
38     'django.contrib.messages.middleware.MessageMiddleware',
39
40     'django.contrib.auth.middleware.AuthenticationMiddleware',
41     'django_cas_ng.middleware.CASMiddleware',
42
43     'django.contrib.admindocs.middleware.XViewMiddleware',
44     'fnp_django_pagination.middleware.PaginationMiddleware',
45     'maintenancemode.middleware.MaintenanceModeMiddleware',
46 )
47
48 if DEBUG:
49     MIDDLEWARE_CLASSES = (
50         'debug_toolbar.middleware.DebugToolbarMiddleware',
51     ) + MIDDLEWARE_CLASSES
52
53 AUTHENTICATION_BACKENDS = (
54     'django.contrib.auth.backends.ModelBackend',
55     'django_cas_ng.backends.CASBackend',
56 )
57
58 ROOT_URLCONF = 'redakcja.urls'
59
60 INSTALLED_APPS = (
61     'django.contrib.auth',
62     'django.contrib.contenttypes',
63     'django.contrib.sessions',
64     'django.contrib.messages',
65     'django.contrib.staticfiles',
66     'django.contrib.sites',
67     'django.contrib.admin',
68     'django.contrib.admindocs',
69     'raven.contrib.django.raven_compat',
70
71     'sorl.thumbnail',
72     'fnp_django_pagination',
73     'django_gravatar',
74     'fileupload',
75     'pipeline',
76     'fnpdjango',
77     'django_cas_ng',
78
79     'catalogue',
80     'cover',
81     'dvcs',
82     'wiki',
83     'wiki_img',
84     'toolbar',
85     'apiclient',
86     'email_mangler',
87 )
88
89 if DEBUG:
90     INSTALLED_APPS += ('debug_toolbar',)
91
92 LOGIN_REDIRECT_URL = '/documents/user'
93
94 MIN_COVER_SIZE = (915, 1270)
95
96 STATICFILES_FINDERS = (
97     'django.contrib.staticfiles.finders.FileSystemFinder',
98     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
99     'pipeline.finders.PipelineFinder',
100 )
101
102 STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
103
104 PIPELINE = {
105     'CSS_COMPRESSOR': None,
106     'JS_COMPRESSOR': None,
107
108     # CSS and JS files to compress
109     'STYLESHEETS': {
110         'detail': {
111             'source_filenames': (
112                 'css/master.css',
113                 'css/toolbar.css',
114                 'css/gallery.css',
115                 'css/history.css',
116                 'css/summary.css',
117                 'css/html.css',
118                 'css/jquery.autocomplete.css',
119                 'css/imgareaselect-default.css',
120                 'css/dialogs.css',
121             ),
122             'output_filename': 'compressed/detail_styles.css',
123         },
124         'catalogue': {
125             'source_filenames': (
126                 'css/filelist.css',
127             ),
128             'output_filename': 'compressed/catalogue_styles.css',
129          },
130          'book': {
131             'source_filenames': (
132                 'css/book.css',
133             ),
134             'output_filename': 'compressed/book.css',
135         },
136         'book_list': {
137             'source_filenames': (
138                 'contextmenu/jquery.contextMenu.css',
139                 'css/book_list.css',
140             ),
141             'output_filename': 'compressed/book_list.css',
142         },
143     },
144     'JAVASCRIPT': {
145         # everything except codemirror
146         'detail': {
147             'source_filenames': (
148                 # libraries
149                 'js/lib/jquery/jquery.autocomplete.js',
150                 'js/lib/jquery/jquery.blockui.js',
151                 'js/lib/jquery/jquery.elastic.js',
152                 'js/lib/jquery/jquery.xmlns.js',
153                 'js/button_scripts.js',
154                 'js/slugify.js',
155
156                 # wiki scripts
157                 'js/wiki/wikiapi.js',
158                 'js/wiki/xslt.js',
159
160                 # base UI
161                 'js/wiki/base.js',
162                 'js/wiki/toolbar.js',
163
164                 # dialogs
165                 'js/wiki/dialog_save.js',
166                 'js/wiki/dialog_revert.js',
167                 'js/wiki/dialog_pubmark.js',
168
169                 # views
170                 'js/wiki/view_history.js',
171                 'js/wiki/view_summary.js',
172                 'js/wiki/view_editor_source.js',
173                 'js/wiki/view_editor_wysiwyg.js',
174                 'js/wiki/view_gallery.js',
175                 'js/wiki/view_annotations.js',
176                 'js/wiki/view_search.js',
177                 'js/wiki/view_column_diff.js',
178             ),
179             'output_filename': 'compressed/detail_scripts.js',
180          },
181         'wiki_img': {
182             'source_filenames': (
183                 # libraries
184                 'js/lib/jquery-1.4.2.min.js',
185                 'js/lib/jquery/jquery.autocomplete.js',
186                 'js/lib/jquery/jquery.blockui.js',
187                 'js/lib/jquery/jquery.elastic.js',
188                 'js/lib/jquery/jquery.imgareaselect.js',
189                 'js/button_scripts.js',
190                 'js/slugify.js',
191
192                 # wiki scripts
193                 'js/wiki_img/wikiapi.js',
194
195                 # base UI
196                 'js/wiki_img/base.js',
197                 'js/wiki/toolbar.js',
198
199                 # dialogs
200                 'js/wiki/dialog_save.js',
201                 'js/wiki/dialog_revert.js',
202                 'js/wiki/dialog_pubmark.js',
203
204                 # views
205                 'js/wiki_img/view_editor_objects.js',
206                 'js/wiki_img/view_editor_motifs.js',
207                 'js/wiki/view_editor_source.js',
208                 'js/wiki/view_history.js',
209                 'js/wiki/view_column_diff.js',
210             ),
211             'output_filename': 'compressed/detail_img_scripts.js',
212          },
213         'catalogue': {
214             'source_filenames': (
215                 'js/catalogue/catalogue.js',
216                 'js/slugify.js',
217                 'email_mangler/email_mangler.js',
218             ),
219             'output_filename': 'compressed/catalogue_scripts.js',
220          },
221          'book': {
222             'source_filenames': (
223                 'js/book_text/jquery.eventdelegation.js',
224                 'js/book_text/jquery.scrollto.js',
225                 'js/book_text/jquery.highlightfade.js',
226                 'js/book_text/book.js',
227             ),
228             'output_filename': 'compressed/book.js',
229         },
230         'book_list': {
231             'source_filenames': (
232                 'contextmenu/jquery.ui.position.js',
233                 'contextmenu/jquery.contextMenu.js',
234                 'js/catalogue/book_list.js',
235             ),
236             'output_filename': 'compressed/book_list.js',
237         }
238     }
239 }