Tested for Django 1.7-1.11
[django-migdal.git] / example_project / core / settings.py
1 """
2 Django settings for core project.
3
4 For more information on this file, see
5 https://docs.djangoproject.com/en/1.6/topics/settings/
6
7 For the full list of settings and their values, see
8 https://docs.djangoproject.com/en/1.6/ref/settings/
9 """
10
11 # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
12 import os
13 BASE_DIR = os.path.dirname(os.path.dirname(__file__))
14
15
16 # Quick-start development settings - unsuitable for production
17 # See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
18
19 # SECURITY WARNING: keep the secret key used in production secret!
20 SECRET_KEY = ')1^j9pxlee5bz+$-g1_tphmnip=u^78r+xskny()61)ulk7n4w'
21
22 # SECURITY WARNING: don't run with debug turned on in production!
23 DEBUG = True
24
25 TEMPLATE_DEBUG = True
26
27 ALLOWED_HOSTS = []
28
29
30 # Application definition
31
32 INSTALLED_APPS = (
33     'django.contrib.admin',
34     'django.contrib.auth',
35     'django.contrib.contenttypes',
36     'django.contrib.sessions',
37     'django.contrib.messages',
38     'django.contrib.staticfiles',
39
40     'django.contrib.sites', # Used by django_comments.
41     'django_comments', # Used by migdal.
42     'django_comments_xtd', # Used by migdal.
43     'migdal',
44     'fnpdjango', # Has template tags used in default migdal templates.
45     'sorl.thumbnail', # Has template tags used in default migdal templates.
46     'fnp_django_pagination', # Has template tags used in default migdal templates.
47     'django_gravatar', # Has template tags used in default migdal templates.
48     'core',
49 )
50
51 MIDDLEWARE_CLASSES = (
52     'django.contrib.sessions.middleware.SessionMiddleware',
53     'fnpdjango.middleware.URLLocaleMiddleware',  # Needed to set language.
54     'django.middleware.common.CommonMiddleware',
55     'django.middleware.csrf.CsrfViewMiddleware',
56     'django.contrib.auth.middleware.AuthenticationMiddleware',
57     'django.contrib.messages.middleware.MessageMiddleware',
58     'django.middleware.clickjacking.XFrameOptionsMiddleware',
59     'fnp_django_pagination.middleware.PaginationMiddleware', # Used in default migdal templates.
60 )
61
62 ROOT_URLCONF = 'core.urls'
63
64 WSGI_APPLICATION = 'core.wsgi.application'
65
66 DATABASES = {
67     'default': {
68         'ENGINE': 'django.db.backends.sqlite3',
69         'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
70     }
71 }
72
73 # We have to provide a base template.
74 TEMPLATE_DIRS = [
75     os.path.join(BASE_DIR, 'core/templates'),
76 ]
77 TEMPLATE_CONTEXT_PROCESSORS = (
78     "django.core.context_processors.request", # Used in template tags.
79     "django.contrib.auth.context_processors.auth",
80     "django.core.context_processors.debug",
81     "django.core.context_processors.i18n",
82     "django.core.context_processors.media",
83     "django.core.context_processors.static",
84     "django.core.context_processors.tz",
85     "django.contrib.messages.context_processors.messages"
86 )
87 TEMPLATES = [
88     {
89         'BACKEND': 'django.template.backends.django.DjangoTemplates',
90         'APP_DIRS': True,
91         'DIRS': TEMPLATE_DIRS,
92         'OPTIONS': {
93             'context_processors': [
94                 "django.template.context_processors.request", # Used in template tags.
95                 "django.contrib.auth.context_processors.auth",
96                 "django.template.context_processors.debug",
97                 "django.template.context_processors.i18n",
98                 "django.template.context_processors.media",
99                 "django.template.context_processors.static",
100                 "django.template.context_processors.tz",
101                 "django.contrib.messages.context_processors.messages"
102             ],
103         }
104     }
105 ]
106
107
108 # These match languages in migrations.
109 LANGUAGE_CODE = 'pl'
110 LANGUAGES = [
111         ('pl', 'Polish'),
112         ('en', 'English'),
113         ]
114
115 TIME_ZONE = 'UTC'
116
117 USE_I18N = True
118
119 USE_L10N = True
120
121 USE_TZ = True
122
123 STATIC_URL = '/static/'
124
125
126 # Match default migdal markup type.
127 from fnpdjango.utils.text.textilepl import textile_pl
128 MARKUP_FIELD_TYPES = (
129     ('textile_pl', textile_pl),
130 )
131
132
133 # Create an Entry type.
134 from fnpdjango.utils.settings import LazyUGettextLazy as gettext
135 from migdal.helpers import EntryType
136
137 MIGDAL_TYPES = (
138     EntryType('blog', gettext('blog'), commentable=True, on_main=True),
139     EntryType('info', gettext('info'), commentable=False, on_main=False),
140 )
141
142
143 # Needed for Haystack to work.
144 HAYSTACK_CONNECTIONS = {
145     'default': {
146         'ENGINE': 'haystack.backends.solr_backend.SolrEngine',
147         'URL': 'http://127.0.0.1:8983/solr/prawokultury'
148     },
149 }
150
151 # django_comments need SITE_ID.
152 SITE_ID = 1