Update Django, add search.
[audio.git] / src / audiobooks / settings.py
1 # Django settings for audiobooks project.
2
3 import os
4 PROJECT_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
5
6
7
8 DEBUG = False
9
10 ADMINS = (
11     # ('Your Name', 'your_email@example.com'),
12 )
13
14 MANAGERS = ADMINS
15
16 DATABASES = {
17     'default': {
18         'ENGINE': 'django.db.backends.postgresql',
19         'NAME': 'audio',
20     }
21 }
22
23 # Local time zone for this installation. Choices can be found here:
24 # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
25 # although not all choices may be available on all operating systems.
26 # On Unix systems, a value of None will cause Django to use the same
27 # timezone as the operating system.
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'
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 SITE_ID = 1
37
38 # If you set this to False, Django will make some optimizations so as not
39 # to load the internationalization machinery.
40 USE_I18N = True
41
42 # If you set this to False, Django will not format dates, numbers and
43 # calendars according to the current locale
44 USE_L10N = True
45
46 # Absolute filesystem path to the directory that will hold user-uploaded files.
47 # Example: "/home/media/media.lawrence.com/media/"
48 MEDIA_ROOT = os.path.join(PROJECT_ROOT, '../media/')
49
50 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
51 # trailing slash.
52 # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
53 MEDIA_URL = '/media/'
54
55 # Absolute path to the directory static files should be collected to.
56 # Don't put anything in this directory yourself; store your static files
57 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
58 # Example: "/home/media/media.lawrence.com/static/"
59 STATIC_ROOT = ''
60
61 # URL prefix for static files.
62 # Example: "http://media.lawrence.com/static/"
63 STATIC_URL = '/static/'
64
65 # URL prefix for admin static files -- CSS, JavaScript and images.
66 # Make sure to use a trailing slash.
67 # Examples: "http://foo.com/static/admin/", "/static/admin/".
68 ADMIN_MEDIA_PREFIX = '/static/admin/'
69
70 # Additional locations of static files
71 STATICFILES_DIRS = (
72     # Put strings here, like "/home/html/static" or "C:/www/django/static".
73     # Always use forward slashes, even on Windows.
74     # Don't forget to use absolute paths, not relative paths.
75 )
76
77 # List of finder classes that know how to find static files in
78 # various locations.
79 STATICFILES_FINDERS = (
80     'django.contrib.staticfiles.finders.FileSystemFinder',
81     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
82 #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
83 )
84
85 # Make this unique, and don't share it with anybody.
86 SECRET_KEY = '8ehk^-+pr(o)k6lh_gl9+ks6gkd9u#fka7fv%ikpk(c%llqa6%'
87
88 TEMPLATES = [
89     {
90         'BACKEND': 'django.template.backends.django.DjangoTemplates',
91         'APP_DIRS': True,
92         'OPTIONS': {
93             'context_processors': [
94                 'django.template.context_processors.debug',
95                 'django.template.context_processors.request',
96                 'django.contrib.auth.context_processors.auth',
97                 'django.contrib.messages.context_processors.messages',
98             ],
99         },
100     },
101 ]
102
103 MIDDLEWARE = (
104     'django.middleware.common.CommonMiddleware',
105     'django.contrib.sessions.middleware.SessionMiddleware',
106     'django.middleware.csrf.CsrfViewMiddleware',
107     'django.contrib.auth.middleware.AuthenticationMiddleware',
108     'django_cas_ng.middleware.CASMiddleware',
109     'django.contrib.messages.middleware.MessageMiddleware',
110     "fnp_django_pagination.middleware.PaginationMiddleware",
111 )
112
113 AUTHENTICATION_BACKENDS = (
114     'django.contrib.auth.backends.ModelBackend',
115     'django_cas_ng.backends.CASBackend',
116 )
117
118 ROOT_URLCONF = 'audiobooks.urls'
119
120 INSTALLED_APPS = (
121     'django.contrib.auth',
122     'django.contrib.contenttypes',
123     'django.contrib.sessions',
124     'django.contrib.sites',
125     'django.contrib.messages',
126     'django.contrib.staticfiles',
127     'django.contrib.admin',
128     'django.contrib.postgres',
129     # Uncomment the next line to enable admin documentation:
130     # 'django.contrib.admindocs',
131     'bootstrap4',
132     'django_cas_ng',
133     'apiclient',
134     'archive',
135     'youtube',
136     "fnp_django_pagination",
137 )
138
139 # A sample logging configuration. The only tangible logging
140 # performed by this configuration is to send an email to
141 # the site admins on every HTTP 500 error.
142 # See http://docs.djangoproject.com/en/dev/topics/logging for
143 # more details on how to customize your logging configuration.
144 LOGGING = {
145     'version': 1,
146     'disable_existing_loggers': False,
147     'filters': {
148          'require_debug_false': {
149              '()': 'django.utils.log.RequireDebugFalse'
150          }
151      },
152     'handlers': {
153         'mail_admins': {
154             'level': 'ERROR',
155             'filters': ['require_debug_false'],
156             'class': 'django.utils.log.AdminEmailHandler'
157         }
158     },
159     'loggers': {
160         'django.request': {
161             'handlers': ['mail_admins'],
162             'level': 'ERROR',
163             'propagate': True,
164         },
165     }
166 }
167
168 CAS_SERVER_URL = "https://logowanie.nowoczesnapolska.org.pl/cas/"
169 CAS_VERSION = "2"
170
171 EMAIL_SUBJECT_PREFIX = '[Audio] '
172 SERVER_EMAIL = 'no-reply@audio.wolnelektury.pl'
173 EMAIL_HOST = 'localhost'
174 EMAIL_PORT = 25
175
176 CELERY_BROKER_URL = 'redis://localhost:6379/0'
177
178 try:
179     from .localsettings import *
180 except:
181     pass