Simplify settings loading a bit. Remove the things which haven't been working for...
[redakcja.git] / src / redakcja / settings / __init__.py
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3 import os.path
4 from redakcja.settings.defaults import *
5 from redakcja.localsettings import *
6
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.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     'fnpdjango.auth_backends.AttrCASBackend',
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     'kombu.transport.django',
76     'pipeline',
77     'fnpdjango',
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 CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
95 CELERY_SEND_TASK_ERROR_EMAILS = True
96 CELERY_ACCEPT_CONTENT = ['pickle']  # Remove when all tasks jsonable.
97
98 MIN_COVER_SIZE = (915, 1270)
99
100 STATICFILES_FINDERS = (
101     'django.contrib.staticfiles.finders.FileSystemFinder',
102     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
103     'pipeline.finders.PipelineFinder',
104 )
105
106 STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
107
108 PIPELINE = {
109     'CSS_COMPRESSOR': None,
110     'JS_COMPRESSOR': None,
111
112     # CSS and JS files to compress
113     'STYLESHEETS': {
114         'detail': {
115             'source_filenames': (
116                 'css/master.css',
117                 'css/toolbar.css',
118                 'css/gallery.css',
119                 'css/history.css',
120                 'css/summary.css',
121                 'css/html.css',
122                 'css/jquery.autocomplete.css',
123                 'css/imgareaselect-default.css',
124                 'css/dialogs.css',
125             ),
126             'output_filename': 'compressed/detail_styles.css',
127         },
128         'catalogue': {
129             'source_filenames': (
130                 'css/filelist.css',
131             ),
132             'output_filename': 'compressed/catalogue_styles.css',
133          },
134          'book': {
135             'source_filenames': (
136                 'css/book.css',
137             ),
138             'output_filename': 'compressed/book.css',
139         },
140         'book_list': {
141             'source_filenames': (
142                 'contextmenu/jquery.contextMenu.css',
143                 'css/book_list.css',
144             ),
145             'output_filename': 'compressed/book_list.css',
146         },
147     },
148     'JAVASCRIPT': {
149         # everything except codemirror
150         'detail': {
151             'source_filenames': (
152                 # libraries
153                 'js/lib/jquery/jquery.autocomplete.js',
154                 'js/lib/jquery/jquery.blockui.js',
155                 'js/lib/jquery/jquery.elastic.js',
156                 'js/lib/jquery/jquery.xmlns.js',
157                 'js/button_scripts.js',
158                 'js/slugify.js',
159
160                 # wiki scripts
161                 'js/wiki/wikiapi.js',
162                 'js/wiki/xslt.js',
163
164                 # base UI
165                 'js/wiki/base.js',
166                 'js/wiki/toolbar.js',
167
168                 # dialogs
169                 'js/wiki/dialog_save.js',
170                 'js/wiki/dialog_revert.js',
171                 'js/wiki/dialog_pubmark.js',
172
173                 # views
174                 'js/wiki/view_history.js',
175                 'js/wiki/view_summary.js',
176                 'js/wiki/view_editor_source.js',
177                 'js/wiki/view_editor_wysiwyg.js',
178                 'js/wiki/view_gallery.js',
179                 'js/wiki/view_annotations.js',
180                 'js/wiki/view_search.js',
181                 'js/wiki/view_column_diff.js',
182             ),
183             'output_filename': 'compressed/detail_scripts.js',
184          },
185         'wiki_img': {
186             'source_filenames': (
187                 # libraries
188                 'js/lib/jquery-1.4.2.min.js',
189                 'js/lib/jquery/jquery.autocomplete.js',
190                 'js/lib/jquery/jquery.blockui.js',
191                 'js/lib/jquery/jquery.elastic.js',
192                 'js/lib/jquery/jquery.imgareaselect.js',
193                 'js/button_scripts.js',
194                 'js/slugify.js',
195
196                 # wiki scripts
197                 'js/wiki_img/wikiapi.js',
198
199                 # base UI
200                 'js/wiki_img/base.js',
201                 'js/wiki/toolbar.js',
202
203                 # dialogs
204                 'js/wiki/dialog_save.js',
205                 'js/wiki/dialog_revert.js',
206                 'js/wiki/dialog_pubmark.js',
207
208                 # views
209                 'js/wiki_img/view_editor_objects.js',
210                 'js/wiki_img/view_editor_motifs.js',
211                 'js/wiki/view_editor_source.js',
212                 'js/wiki/view_history.js',
213                 'js/wiki/view_column_diff.js',
214             ),
215             'output_filename': 'compressed/detail_img_scripts.js',
216          },
217         'catalogue': {
218             'source_filenames': (
219                 'js/catalogue/catalogue.js',
220                 'js/slugify.js',
221                 'email_mangler/email_mangler.js',
222             ),
223             'output_filename': 'compressed/catalogue_scripts.js',
224          },
225          'book': {
226             'source_filenames': (
227                 'js/book_text/jquery.eventdelegation.js',
228                 'js/book_text/jquery.scrollto.js',
229                 'js/book_text/jquery.highlightfade.js',
230                 'js/book_text/book.js',
231             ),
232             'output_filename': 'compressed/book.js',
233         },
234         'book_list': {
235             'source_filenames': (
236                 'contextmenu/jquery.ui.position.js',
237                 'contextmenu/jquery.contextMenu.js',
238                 'js/catalogue/book_list.js',
239             ),
240             'output_filename': 'compressed/book_list.js',
241         }
242     }
243 }