Mostly Javascript refactoring.
[redakcja.git] / platforma / settings.py
1 # -*- coding: utf-8 -*-
2 import os.path
3
4 PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__))
5
6 DEBUG = False
7 TEMPLATE_DEBUG = DEBUG
8
9 MAINTENANCE_MODE = False
10
11 ADMINS = (
12     # (u'Marek Stępniowski', 'marek@stepniowski.com'),
13     (u'Łukasz Rekucki', 'lrekucki@gmail.com'),
14 )
15
16 MANAGERS = ADMINS
17
18 DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
19 DATABASE_NAME = PROJECT_ROOT + '/dev.sqlite'             # Or path to database file if using sqlite3.
20 DATABASE_USER = ''             # Not used with sqlite3.
21 DATABASE_PASSWORD = ''         # Not used with sqlite3.
22 DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
23 DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
24
25 # Local time zone for this installation. Choices can be found here:
26 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
27 # although not all choices may be available on all operating systems.
28 # If running in a Windows environment this must be set to the same as your
29 # system time zone.
30 TIME_ZONE = 'Europe/Warsaw Poland'
31
32 # Language code for this installation. All choices can be found here:
33 # http://www.i18nguy.com/unicode/language-identifiers.html
34 LANGUAGE_CODE = 'pl'
35
36 #import locale
37 #locale.setlocale(locale.LC_ALL, '')
38
39 SITE_ID = 1
40
41 # If you set this to False, Django will make some optimizations so as not
42 # to load the internationalization machinery.
43 USE_I18N = True
44
45 # Absolute path to the directory that holds media.
46 # Example: "/home/media/media.lawrence.com/"
47 MEDIA_ROOT = PROJECT_ROOT + '/media/'
48 STATIC_ROOT = PROJECT_ROOT + '/static/'
49
50 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
51 # trailing slash if there is a path component (optional in other cases).
52 # Examples: "http://media.lawrence.com", "http://example.com/media/"
53 MEDIA_URL = '/media/'
54 STATIC_URL = '/static/'
55
56 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
57 # trailing slash.
58 # Examples: "http://foo.com/media/", "/media/".
59 ADMIN_MEDIA_PREFIX = '/admin-media/'
60
61 # Make this unique, and don't share it with anybody.
62 SECRET_KEY = 'ife@x^_lak+x84=lxtr!-ur$5g$+s6xt85gbbm@e_fk6q3r8=+'
63
64 # List of callables that know how to import templates from various sources.
65 TEMPLATE_LOADERS = (
66     'django.template.loaders.filesystem.load_template_source',
67     'django.template.loaders.app_directories.load_template_source',
68 #     'django.template.loaders.eggs.load_template_source',
69 )
70
71 TEMPLATE_CONTEXT_PROCESSORS = (
72     "django.core.context_processors.auth",
73     "django.core.context_processors.debug",
74     "django.core.context_processors.i18n",
75     "platforma.context_processors.settings",
76     "django.core.context_processors.request",
77 )
78
79
80 MIDDLEWARE_CLASSES = (
81     'django.middleware.common.CommonMiddleware',
82     'django.contrib.sessions.middleware.SessionMiddleware',
83
84     'django.contrib.auth.middleware.AuthenticationMiddleware',
85     'django_cas.middleware.CASMiddleware',
86
87     'django.middleware.doc.XViewMiddleware',    
88     'maintenancemode.middleware.MaintenanceModeMiddleware',
89     'debug_toolbar.middleware.DebugToolbarMiddleware'
90 )
91
92 AUTHENTICATION_BACKENDS = (
93     'django.contrib.auth.backends.ModelBackend',
94     'django_cas.backends.CASBackend',
95 )
96
97 ROOT_URLCONF = 'urls'
98
99 TEMPLATE_DIRS = (
100     PROJECT_ROOT + '/templates',
101 )
102
103
104 #
105 # Central Auth System
106 #
107 ## Set this to where the CAS server lives 
108 # CAS_SERVER_URL = "http://cas.fnp.pl/
109 CAS_ADMIN_PREFIX = "/admin/"
110 CAS_LOGOUT_COMPLETELY = True
111
112 # CSS and JS files to compress
113 COMPRESS_CSS = {
114     'detail': {
115          'source_filenames': (
116             'css/master.css',
117             'css/history.css', 
118             'css/html.css',             
119             'css/jquery.autocomplete.css',
120         ),
121         'output_filename': 'compressed/detail_styles_?.css',
122     },
123     'listing': {
124         'source_filenames': (
125             'css/filelist.css', 
126         ),             
127         'output_filename': 'compressed/listing_styles_?.css',
128      }
129 }
130  
131 COMPRESS_JS = {
132     # everything except codemirror and jquery (which we take from google)
133     'detail': {
134         'source_filenames': (
135                 #'js/jquery-1.4.2.min.js', 
136                 'js/jquery.autocomplete.js', 
137                 'js/jquery.blockui.js',
138                 'js/jquery.elastic.js',
139                 'js/button_scripts.js',
140                 'js/slugify.js',
141                 
142                 # wiki scripts
143                 'js/wiki/wikiapi.js',
144                 'js/wiki/base.js',
145                 'js/wiki/xslt.js',
146                 'js/wiki/history.js',
147                 'js/wiki/source_editor.js',
148                 'js/wiki/wysiwyg_editor.js',                
149                 'js/wiki/main.js',
150         ),             
151         'output_filename': 'compressed/detail_scripts_?.js',
152      },
153     'listing': {
154         'source_filenames': (
155                 # 'js/jquery-1.4.2.min.js', 
156                 'js/slugify.js',                
157         ),             
158         'output_filename': 'compressed/listing_scripts_?.js',
159      }
160 }
161  
162 COMPRESS = True
163 COMPRESS_CSS_FILTERS = None
164 COMPRESS_JS_FILTERS = None
165 COMPRESS_AUTO = False
166 COMPRESS_VERSION = True
167 COMPRESS_VERSIONING = 'compress.versioning.hash.MD5Versioning'
168
169
170 INSTALLED_APPS = (
171     'django.contrib.auth',
172     'django.contrib.contenttypes',
173     'django.contrib.sessions',
174     'django.contrib.sites',
175     'django.contrib.admin',
176     'django.contrib.admindocs',
177
178     'django_nose',
179     'debug_toolbar',
180     
181     'compress',
182     'south',
183     'sorl.thumbnail',
184     'filebrowser',
185
186     'wiki',    
187     'toolbar',
188 )
189
190
191 #
192 # Nose tests
193 #
194
195 TEST_RUNNER = 'django_nose.run_tests'
196 TEST_MODULES = ('wiki', 'toolbar', 'vstorage')
197 NOSE_ARGS = (
198     '--tests=' + ','.join(TEST_MODULES),
199     '--cover-package=' + ','.join(TEST_MODULES),
200     '-d',
201     '--with-coverage',
202     '--with-doctest'
203 )
204
205
206 FILEBROWSER_URL_FILEBROWSER_MEDIA = STATIC_URL + 'filebrowser/'
207 FILEBROWSER_DIRECTORY = 'images/'
208 FILEBROWSER_ADMIN_VERSIONS = []
209 FILEBROWSER_VERSIONS_BASEDIR = 'thumbnails/'
210 FILEBROWSER_DEFAULT_ORDER = "path_relative"
211
212 # REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books'
213 IMAGE_DIR = 'images'
214
215 # Python logging settings
216 import logging
217
218 log = logging.getLogger('platforma')
219 log.setLevel(logging.DEBUG)
220 ch = logging.StreamHandler()
221 ch.setLevel(logging.DEBUG)
222 formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
223 ch.setFormatter(formatter)
224 log.addHandler(ch)
225
226 # Import localsettings file, which may override settings defined here
227 try:
228     from localsettings import *
229 except ImportError:
230     pass
231
232 try:
233     LOGGING_CONFIG_FILE 
234 except NameError:
235     LOGGING_CONFIG_FILE = os.path.join(PROJECT_ROOT, 
236                                 ('logging.cfg' if not DEBUG else 'logging.cfg.dev'))
237
238 try:
239     import logging
240     import logging.config
241
242     logging.config.fileConfig(LOGGING_CONFIG_FILE)    
243 except ImportError, exc:
244     import traceback
245     traceback.print_exc()
246     raise
247