• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

d120 / pyfeedback / 12918497457

22 Jan 2025 10:40PM UTC coverage: 88.95% (-0.1%) from 89.099%
12918497457

push

github

4-dash
added test

2600 of 2923 relevant lines covered (88.95%)

0.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.83
/src/settings.py
1
# coding=utf-8
2
# Django settings for feedback project.
3

4
# determine if this is a production system
5
import os
1✔
6
import sys
1✔
7
from django.utils.translation import gettext_lazy as _
1✔
8

9
DEBUG = True
1✔
10

11
# default is False, make True to see exeptions when DEBUG = False
12
DEBUG_PROPAGATE_EXCEPTIONS = False
1✔
13

14
ADMINS = (
1✔
15
    ('Feedback-Team', 'feedback@lists.d120.de'),
16
)
17

18
MANAGERS = ADMINS
1✔
19
EMAIL_SUBJECT_PREFIX = ''
1✔
20

21
BASE_PATH = os.path.dirname(os.path.abspath(__file__)) + '/../'
1✔
22

23
DATABASES = {
1✔
24
    'default': {
25
        'ENGINE': 'django.db.backends.sqlite3',
26
        'NAME': BASE_PATH + "db/feedback.db",
27
        'USER': '',
28
        'PASSWORD': '',
29
    }
30
}
31

32
ALLOWED_HOSTS = []
1✔
33

34
# Local time zone for this installation. Choices can be found here:
35
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
36
# although not all choices may be available on all operating systems.
37
# If running in a Windows environment this must be set to the same as your
38
# system time zone.
39
TIME_ZONE = 'Europe/Berlin'
1✔
40

41
USE_TZ = False # before django 5.0 USE_TZ was default False
1✔
42

43
# Language code for this installation. All choices can be found here:
44
# http://www.i18nguy.com/unicode/language-identifiers.html
45
LANGUAGE_CODE = 'de'
1✔
46

47
LANGUAGES = [
1✔
48
    ("de", _("German")),
49
    ("en", _("English")),
50
]
51

52
LOCALE_PATHS = (
1✔
53
    os.path.join(BASE_PATH, 'src/locale'),
54
)
55

56
SITE_ID = 1
1✔
57

58
# If you set this to False, Django will make some optimizations so as not
59
# to load the internationalization machinery.
60
USE_I18N = True
1✔
61

62
USE_L10N = True
1✔
63

64
# Absolute path to the directory that holds media.
65
# Example: "/home/media/media.lawrence.com/"
66
MEDIA_ROOT = ''
1✔
67

68
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
69
# trailing slash if there is a path component (optional in other cases).
70
# Examples: "http://media.lawrence.com", "http://example.com/media/"
71
MEDIA_URL = ''
1✔
72

73
# Absolute path to the directory static files should be collected to.
74
# Don't put anything in this directory yourself; store your static files
75
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
76
# Example: "/home/media/media.lawrence.com/static/"
77
STATIC_ROOT = BASE_PATH + 'static/'
1✔
78

79
# URL prefix for static files.
80
# Example: "http://media.lawrence.com/static/"
81
STATIC_URL = '/feedback/static/'
1✔
82

83
# Additional locations of static files
84
STATICFILES_DIRS = (
1✔
85
    # Put strings here, like "/home/html/static" or "C:/www/django/static".
86
    # Always use forward slashes, even on Windows.
87
    # Don't forget to use absolute paths, not relative paths.
88
    BASE_PATH + 'media/',
89
    BASE_PATH + 'node_modules/',
90
)
91

92
# List of finder classes that know how to find static files in
93
# various locations.
94
STATICFILES_FINDERS = (
1✔
95
    'django.contrib.staticfiles.finders.FileSystemFinder',
96
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
97
#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
98
)
99

100
# Make this unique, and don't share it with anybody.
101
SECRET_KEY = 's=15!5%-sw+4w*hsw(=h%rzyn&jy*&l1w%x2z4$5d^4p&feiwb'
1✔
102

103
# Testing Setting to unload the debug toolbar when testing, see https://github.com/jazzband/django-debug-toolbar/issues/1405
104
TESTING = 'test' or 'check' in sys.argv
1✔
105

106
# List of callables that know how to import templates from various sources.
107
# Filesystem muss vor app_directories stehen, damit unsere Templates für registration den Standard
108
# überschreiben!
109

110
MIDDLEWARE = [
1✔
111
    'django.middleware.csrf.CsrfViewMiddleware',
112
    'django.contrib.sessions.middleware.SessionMiddleware',
113
    'django.middleware.locale.LocaleMiddleware',
114
    'django.middleware.common.CommonMiddleware',
115
    'django.contrib.messages.middleware.MessageMiddleware',
116
    'django.contrib.auth.middleware.AuthenticationMiddleware',
117
    'feedback.auth.FSDebugRemoteUserMiddleware',
118
    'allauth.account.middleware.AccountMiddleware',
119
    # 'whitenoise.middleware.WhiteNoiseMiddleware', # while DEBUG=False servers static files, Note:first pip install whitenoise
120
]
121
if not TESTING:
1✔
122
    MIDDLEWARE += 'debug_toolbar.middleware.DebugToolbarMiddleware'
×
123

124
ROOT_URLCONF = 'urls'
1✔
125

126
TEMPLATES = [
1✔
127
    {
128
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
129
        'DIRS': [BASE_PATH + "src/templates"],
130
        'OPTIONS': {
131
            'context_processors': ['django.contrib.auth.context_processors.auth',
132
            "django.contrib.messages.context_processors.messages",
133
            "django.template.context_processors.request",
134
            ],
135
            'loaders': [
136
            'django.template.loaders.filesystem.Loader',
137
            'django.template.loaders.app_directories.Loader',
138
            ]
139
        },
140
    },
141
]
142

143

144
INSTALLED_APPS = [
1✔
145
    'django.contrib.auth',
146
    'django.contrib.contenttypes', # wird von admin benötigt
147
    'django.contrib.sessions',
148
    'django.contrib.staticfiles',
149
    'django.contrib.admin',
150
    'django.contrib.admindocs',
151
    'django.contrib.messages',
152
    'formtools',
153
    'feedback',
154
    'allauth',
155
    'allauth.account',
156
    'allauth.socialaccount',
157
    'allauth.socialaccount.providers.openid_connect',
158
]
159

160
if not TESTING:
1✔
161
    INSTALLED_APPS += 'django_debug'
×
162

163
AUTHENTICATION_BACKENDS = (
1✔
164
    'django.contrib.auth.backends.ModelBackend',
165
    'feedback.auth.FSAccountBackend',
166
    'feedback.auth.TakeoverBackend',
167
    'feedback.auth.VeranstalterBackend',
168
    'allauth.account.auth_backends.AuthenticationBackend',
169
)
170

171
ACCOUNT_LOGOUT_REDIRECT_URL ='/accounts/login/'
1✔
172

173

174
SOCIALACCOUNT_ADAPTER = 'feedback.auth_adapter.FeedbackSocialAccountAdapter'
1✔
175

176
SOCIALACCOUNT_ONLY = True
1✔
177
ACCOUNT_EMAIL_VERIFICATION = 'none'
1✔
178

179
SOCIALACCOUNT_PROVIDERS = {
1✔
180
    "openid_connect": {
181
        "APPS": [
182
            {
183
                "provider_id": "keycloak",
184
                "name": "Keycloak",
185
                "client_id": "",
186
                "secret": "",
187
                "settings": {
188
                    "server_url": "",
189
                },
190
            }
191
        ]
192
    }
193
}
194

195
# A sample logging configuration. The only tangible logging
196
# performed by this configuration is to send an email to
197
# the site admins on every HTTP 500 error when DEBUG=False.
198
# See http://docs.djangoproject.com/en/dev/topics/logging for
199
# more details on how to customize your logging configuration.
200
LOGGING = {
1✔
201
    'version': 1,
202
    'disable_existing_loggers': False,
203
    'filters': {
204
        'require_debug_false': {
205
            '()': 'django.utils.log.RequireDebugFalse'
206
        },
207
    },
208
    'handlers': {
209
        'mail_admins': {
210
            'level': 'ERROR',
211
            'filters': ['require_debug_false'],
212
            'class': 'django.utils.log.AdminEmailHandler'
213
        },
214
        'console': {
215
            'level':'DEBUG',
216
            'class':'logging.StreamHandler',
217
        },
218
    },
219
    'loggers': {
220
        'django.request': {
221
            'handlers': ['mail_admins'],
222
            'level': 'ERROR',
223
            'propagate': True,
224
        },
225
        'auth': {
226
            'handlers': ['console'],
227
            'level': 'DEBUG',
228
        },
229
    }
230
}
231

232
LOGIN_URL = '/de/intern/'
1✔
233
LOGIN_REDIRECT_URL = '/de/intern/uebersicht/'
1✔
234

235
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
1✔
236

237
# Common Middleware settings
238
APPEND_SLASH = True
1✔
239

240
# Path to LaTeX files
241
LATEX_PATH = BASE_PATH + 'latex/anschreiben/'
1✔
242

243
TESTDATA_PATH = BASE_PATH + 'testdata/'
1✔
244

245
# Ranking
246
THRESH_SHOW = 5
1✔
247
THRESH_VALID = 20
1✔
248

249
DEFAULT_FROM_EMAIL = "Feedback-Team <feedback@fachschaft.informatik.tu-darmstadt.de>"
1✔
250
SERVER_EMAIL = DEFAULT_FROM_EMAIL
1✔
251

252
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
1✔
253

254
USERNAME_VERANSTALTER = 'veranstalter'
1✔
255

256
# for debug toolbar
257
INTERNAL_IPS = ('127.0.0.1',)
1✔
258

259
# Coverage testing
260
#TEST_RUNNER = 'django_coverage.coverage_runner.CoverageRunner'
261
COVERAGE_REPORT_HTML_OUTPUT_DIR = BASE_PATH + 'htmlcov'
1✔
262
COVERAGE_PATH_EXCLUDES = [r'.svn', r'templates']
1✔
263
COVERAGE_MODULE_EXCLUDES = ['tests$', 'settings$', 'locale$', 'django', 'migrations', 'south',
1✔
264
                            'debug_toolbar']
265
COVERAGE_CODE_EXCLUDES = ['from .* import .*', 'import .*']
1✔
266

267
DEBUG_TOOLBAR_CONFIG = {'INTERCEPT_REDIRECTS': False}
1✔
268

269
# application-specific-cookies
270
CSRF_COOKIE_NAME = 'pyfeedback_csrftoken'
1✔
271
SESSION_COOKIE_NAME = 'pyfeedback_sessionid'
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc