blob: 939e5e370945bdbcd45cea2c56fe6178271a4474 [file] [log] [blame]
Dirk Vogtf130c752016-08-23 14:45:01 +02001"""
2Django settings for hiccup_server project.
3
4Generated by 'django-admin startproject' using Django 1.9.7.
5
6For more information on this file, see
7https://docs.djangoproject.com/en/1.9/topics/settings/
8
9For the full list of settings and their values, see
10https://docs.djangoproject.com/en/1.9/ref/settings/
11"""
12
13import os
14
15# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
16BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
17
18
19# Quick-start development settings - unsuitable for production
20# See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/
21
22# SECURITY WARNING: keep the secret key used in production secret!
23SECRET_KEY = '7u+#ha3hk!x+*)clhs46%n*)w1q+5s4+yoc#1!nm0b%fwwrud@'
24
25# SECURITY WARNING: don't run with debug turned on in production!
Dirk Vogtf2a33422016-10-11 17:17:26 +020026DEBUG = True
Dirk Vogtf130c752016-08-23 14:45:01 +020027
Dirk Vogt20539e52016-08-26 11:17:35 +020028ALLOWED_HOSTS = ['*']
Dirk Vogtf130c752016-08-23 14:45:01 +020029
30
31# Application definition
32
33INSTALLED_APPS = [
34 'django.contrib.admin',
35 'django.contrib.auth',
36 'django.contrib.contenttypes',
37 'django.contrib.sessions',
Dirk Vogt57a615d2017-05-04 22:29:54 +020038 'django.contrib.sites',
Dirk Vogtf130c752016-08-23 14:45:01 +020039 'django.contrib.messages',
40 'django.contrib.staticfiles',
Dirk Vogt47d80ba2016-08-26 09:31:39 +020041 'rest_framework',
Dirk Vogtf2a33422016-10-11 17:17:26 +020042 'rest_framework.authtoken',
Dirk Vogtf130c752016-08-23 14:45:01 +020043 'crashreports',
Dirk Vogt62ff7f22017-05-04 16:07:21 +020044 'crashreport_stats',
Dirk Vogtf2a33422016-10-11 17:17:26 +020045 'taggit',
Dirk Vogtd1345212016-09-14 14:31:45 +020046 'crispy_forms',
Dirk Vogtf5a15532016-09-26 15:52:24 +020047 'bootstrap3',
Dirk Vogt57a615d2017-05-04 22:29:54 +020048 'bootstrapform',
Dirk Vogtf2a33422016-10-11 17:17:26 +020049 'django_extensions',
Dirk Vogt62ff7f22017-05-04 16:07:21 +020050 'djfrontend',
Dirk Vogt57a615d2017-05-04 22:29:54 +020051 'djfrontend.skeleton',
52 'allauth',
53 'allauth.account',
54 'allauth.socialaccount',
55 'allauth.socialaccount.providers.google',
Dirk Vogtf130c752016-08-23 14:45:01 +020056]
57
58MIDDLEWARE_CLASSES = [
59 'django.middleware.security.SecurityMiddleware',
60 'django.contrib.sessions.middleware.SessionMiddleware',
61 'django.middleware.common.CommonMiddleware',
62 'django.middleware.csrf.CsrfViewMiddleware',
63 'django.contrib.auth.middleware.AuthenticationMiddleware',
64 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
65 'django.contrib.messages.middleware.MessageMiddleware',
66 'django.middleware.clickjacking.XFrameOptionsMiddleware',
67]
68
69ROOT_URLCONF = 'hiccup.urls'
70
Dirk Vogt57a615d2017-05-04 22:29:54 +020071TEMPLATE_LOADERS = (
72 'django.template.loaders.filesystem.Loader',
73 'django.template.loaders.app_directories.Loader',
74# 'django.template.loaders.eggs.Loader',
75)
76
Dirk Vogtf130c752016-08-23 14:45:01 +020077TEMPLATES = [
78 {
79 'BACKEND': 'django.template.backends.django.DjangoTemplates',
Dirk Vogt57a615d2017-05-04 22:29:54 +020080 'DIRS': [os.path.join(BASE_DIR,'hiccup', 'templates')],
Dirk Vogtf130c752016-08-23 14:45:01 +020081 'APP_DIRS': True,
82 'OPTIONS': {
83 'context_processors': [
84 'django.template.context_processors.debug',
85 'django.template.context_processors.request',
86 'django.contrib.auth.context_processors.auth',
87 'django.contrib.messages.context_processors.messages',
Dirk Vogt57a615d2017-05-04 22:29:54 +020088 # `allauth` needs this from django
89 'django.template.context_processors.request',
Dirk Vogtf130c752016-08-23 14:45:01 +020090 ],
91 },
92 },
93]
94
Dirk Vogt57a615d2017-05-04 22:29:54 +020095AUTHENTICATION_BACKENDS = (
96 # Needed to login by username in Django admin, regardless of `allauth`
97 'django.contrib.auth.backends.ModelBackend',
98
99 # `allauth` specific authentication methods, such as login by e-mail
100 'allauth.account.auth_backends.AuthenticationBackend',
101)
102
Dirk Vogtf130c752016-08-23 14:45:01 +0200103#WSGI_APPLICATION = 'hiccup_server.wsgi.application'
104
105
106# Database
107# https://docs.djangoproject.com/en/1.9/ref/settings/#databases
108
109DATABASES = {
110 'default': {
111 'ENGINE': 'django.db.backends.sqlite3',
112 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
113 }
114}
115
116
117# Password validation
118# https://docs.djangoproject.com/en/1.9/ref/settings/#auth-password-validators
119
120AUTH_PASSWORD_VALIDATORS = [
121 {
122 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
123 },
124 {
125 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
126 },
127 {
128 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
129 },
130 {
131 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
132 },
133]
134
Dirk Vogtf130c752016-08-23 14:45:01 +0200135# Internationalization
136# https://docs.djangoproject.com/en/1.9/topics/i18n/
137
138LANGUAGE_CODE = 'en-us'
139TIME_ZONE = 'Europe/Amsterdam'
140USE_I18N = True
141USE_L10N = True
142USE_TZ = True
143
Dirk Vogt47d80ba2016-08-26 09:31:39 +0200144REST_FRAMEWORK = {
Dirk Vogtf2a33422016-10-11 17:17:26 +0200145 'DEFAULT_AUTHENTICATION_CLASSES': (
146 'rest_framework.authentication.BasicAuthentication',
147 'rest_framework.authentication.SessionAuthentication',
148 'rest_framework.authentication.TokenAuthentication',
149 ),
Dirk Vogt47d80ba2016-08-26 09:31:39 +0200150 'DEFAULT_PERMISSION_CLASSES': (
151 'rest_framework.permissions.IsAuthenticated',
Dirk Vogtd1345212016-09-14 14:31:45 +0200152 ),
Dirk Vogt83107df2017-05-02 12:04:19 +0200153 'DEFAULT_FILTER_BACKENDS': ('rest_framework.filters.DjangoFilterBackend',),
154 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
Dirk Vogt57a615d2017-05-04 22:29:54 +0200155 'PAGE_SIZE': 100
156}
157
158SITE_ID = 1
159
160SOCIALACCOUNT_ADAPTER ="hiccup.allauth_adapters.FairphoneAccountAdapter"
161LOGIN_REDIRECT_URL="/hiccup_stats/"
162# disable form signups
163ACCOUNT_ADAPTER ="hiccup.allauth_adapters.FormAccountAdapter"
164ACCOUNT_EMAIL_REQUIRED=True
165ACCOUNT_LOGOUT_REDIRECT_URL="/accounts/login/"
166
167SOCIALACCOUNT_PROVIDERS = {
168 'google': {
169 'SCOPE': [
170 'profile',
171 'email',
172 ],
173 'AUTH_PARAMS': {
174 'access_type': 'online',
175 }
176 }
Dirk Vogt47d80ba2016-08-26 09:31:39 +0200177}
178
Dirk Vogtf130c752016-08-23 14:45:01 +0200179# Static files (CSS, JavaScript, Images)
180# https://docs.djangoproject.com/en/1.9/howto/static-files/
181
182STATIC_URL = '/static/'
Dirk Vogt20539e52016-08-26 11:17:35 +0200183
184STATIC_ROOT = "/home/hiccup/static/static"
Dirk Vogtd8b956b2016-11-22 15:03:21 +0100185
Franz-Xaver Geiger69909c92018-02-27 17:02:38 +0100186
187# Logging
188# https://docs.djangoproject.com/en/2.0/topics/logging/#examples
189
190LOGGING = {
191 'version': 1,
192 'disable_existing_loggers': False,
193 'handlers': {
194 'file': {
195 'level': 'DEBUG',
196 'class': 'logging.FileHandler',
197 'filename': '/home/hiccup/log/debug.log',
198 },
199 },
200 'loggers': {
201 'django': {
202 'handlers': ['file'],
203 'level': 'DEBUG',
204 'propagate': True,
205 },
206 },
207}
208
Dirk Vogtd8b956b2016-11-22 15:03:21 +0100209try:
210 from local_settings import *
211except ImportError as e:
212 pass