apis-acdhch-default-settings 1.0.0__tar.gz → 1.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/PKG-INFO +1 -1
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/apis_acdhch_default_settings/settings.py +53 -51
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/pyproject.toml +1 -1
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/README.md +0 -0
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/apis_acdhch_default_settings/__init__.py +0 -0
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/apis_acdhch_default_settings/ldapauth.py +0 -0
- {apis_acdhch_default_settings-1.0.0 → apis_acdhch_default_settings-1.1.1}/apis_acdhch_default_settings/urls.py +0 -0
|
@@ -30,38 +30,6 @@ BASE_DIR = os.path.dirname(
|
|
|
30
30
|
os.path.dirname(os.path.abspath(os.path.join(__file__, "../")))
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
-
SHARED_URL = "https://shared.acdh.oeaw.ac.at/"
|
|
34
|
-
|
|
35
|
-
PROJECT_NAME = "apis"
|
|
36
|
-
PROJECT_SHARED = "https://shared.acdh.oeaw.ac.at/apis/"
|
|
37
|
-
PROJECT_DEFAULT_MD = {
|
|
38
|
-
"title": "TITLE",
|
|
39
|
-
"author": "Matthias Schlögl, Peter Andorfer",
|
|
40
|
-
"subtitle": "SUBTITLE",
|
|
41
|
-
"description": """This is a default metadata file. To change this, provide\
|
|
42
|
-
provide a following file {PROJECT_SHARED}/{PROJECT_NAME}/metadata.json""",
|
|
43
|
-
"github": "https://github.com/acdh-oeaw/apis-webpage-base",
|
|
44
|
-
"production instance": None,
|
|
45
|
-
"purpose_de": "",
|
|
46
|
-
"purpose_en": """""",
|
|
47
|
-
"version": ["apis_core", "charts", "django"],
|
|
48
|
-
"matomo_id": "",
|
|
49
|
-
"matomo_url": "",
|
|
50
|
-
"imprint": "/imprint",
|
|
51
|
-
"social_media": [
|
|
52
|
-
("fab fa-twitter", "https://twitter.com/ACDH_OeAW"),
|
|
53
|
-
("fab fa-youtube", "https://www.youtube.com/channel/UCgaEMaMbPkULYRI5u6gvG-w"),
|
|
54
|
-
],
|
|
55
|
-
"social_media": [
|
|
56
|
-
("fab fa-twitter fa-2x", "https://twitter.com/ACDH_OeAW"),
|
|
57
|
-
(
|
|
58
|
-
"fab fa-youtube fa-2x",
|
|
59
|
-
"https://www.youtube.com/channel/UCgaEMaMbPkULYRI5u6gvG-w",
|
|
60
|
-
),
|
|
61
|
-
],
|
|
62
|
-
"app_type": "database",
|
|
63
|
-
}
|
|
64
|
-
|
|
65
33
|
# Application definition
|
|
66
34
|
# put apis_override_select2js at the beginning of the list
|
|
67
35
|
# to make its static files weigh more than from the other apps
|
|
@@ -80,30 +48,35 @@ INSTALLED_APPS = [
|
|
|
80
48
|
"django_filters",
|
|
81
49
|
"django_tables2",
|
|
82
50
|
"rest_framework",
|
|
83
|
-
"
|
|
51
|
+
"apis_ontology",
|
|
84
52
|
"apis_core.apis_entities",
|
|
85
53
|
"apis_core.apis_metainfo",
|
|
86
54
|
"apis_core.apis_relations",
|
|
87
55
|
"apis_core.apis_vocabularies",
|
|
88
56
|
"apis_core.generic",
|
|
57
|
+
"apis_core.core",
|
|
89
58
|
"rest_framework.authtoken",
|
|
90
|
-
# "drf_yasg",
|
|
91
59
|
"drf_spectacular",
|
|
92
60
|
"csvexport",
|
|
93
|
-
"apis_ontology",
|
|
94
61
|
]
|
|
95
62
|
|
|
63
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-USE_X_FORWARDED_HOST
|
|
96
64
|
USE_X_FORWARDED_HOST = True
|
|
65
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#secure-proxy-ssl-header
|
|
97
66
|
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|
98
67
|
|
|
68
|
+
# drf-spectacular settings
|
|
69
|
+
# https://drf-spectacular.readthedocs.io/en/latest/settings.html
|
|
99
70
|
SPECTACULAR_SETTINGS: Dict[str, Any] = {
|
|
100
71
|
"TITLE": "APIS generic API",
|
|
101
72
|
"DESCRIPTIOPN": "Provides access to the main APIS data-model endpoints.",
|
|
102
73
|
"LICENSE": {"name": "MIT License", "url": "https://www.mit.edu/~amini/LICENSE.md"},
|
|
103
74
|
"VERSION": "0.13",
|
|
75
|
+
"DEFAULT_GENERATOR_CLASS": 'apis_core.generic.generators.CustomSchemaGenerator'
|
|
104
76
|
}
|
|
105
77
|
|
|
106
|
-
|
|
78
|
+
# django-csp settings
|
|
79
|
+
# https://django-csp.readthedocs.io/en/latest/migration-guide.html#migration-guide-chapter
|
|
107
80
|
CSP_DEFAULT_SRC = (
|
|
108
81
|
"'self'",
|
|
109
82
|
"'unsafe-inline'",
|
|
@@ -124,8 +97,12 @@ CSP_DEFAULT_SRC = (
|
|
|
124
97
|
)
|
|
125
98
|
CSP_FRAME_SRC = ("sennierer.github.io",)
|
|
126
99
|
|
|
100
|
+
# django-crispy-forms settings
|
|
101
|
+
# https://django-crispy-forms.readthedocs.io/en/latest/install.html#template-packs
|
|
127
102
|
CRISPY_TEMPLATE_PACK = "bootstrap4"
|
|
128
103
|
|
|
104
|
+
# django-rest-framework settings
|
|
105
|
+
# https://www.django-rest-framework.org/api-guide/settings/
|
|
129
106
|
REST_FRAMEWORK = {
|
|
130
107
|
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
|
|
131
108
|
"PAGE_SIZE": 50,
|
|
@@ -144,6 +121,7 @@ REST_FRAMEWORK = {
|
|
|
144
121
|
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
|
145
122
|
}
|
|
146
123
|
|
|
124
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-MIDDLEWARE
|
|
147
125
|
MIDDLEWARE = [
|
|
148
126
|
"allow_cidr.middleware.AllowCIDRMiddleware",
|
|
149
127
|
"django.middleware.security.SecurityMiddleware",
|
|
@@ -153,12 +131,15 @@ MIDDLEWARE = [
|
|
|
153
131
|
"django.middleware.csrf.CsrfViewMiddleware",
|
|
154
132
|
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
155
133
|
"django.contrib.messages.middleware.MessageMiddleware",
|
|
134
|
+
"django.middleware.clickjacking.XFrameOptionsMiddleware",
|
|
156
135
|
"csp.middleware.CSPMiddleware",
|
|
157
136
|
"crum.CurrentRequestUserMiddleware",
|
|
158
137
|
]
|
|
159
138
|
|
|
139
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#root-urlconf
|
|
160
140
|
ROOT_URLCONF = "apis_acdhch_default_settings.urls"
|
|
161
141
|
|
|
142
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#templates
|
|
162
143
|
TEMPLATES = [
|
|
163
144
|
{
|
|
164
145
|
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
@@ -175,9 +156,7 @@ TEMPLATES = [
|
|
|
175
156
|
}
|
|
176
157
|
]
|
|
177
158
|
|
|
178
|
-
#
|
|
179
|
-
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
|
180
|
-
|
|
159
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
|
181
160
|
AUTH_PASSWORD_VALIDATORS = [
|
|
182
161
|
{"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"},
|
|
183
162
|
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
|
|
@@ -185,44 +164,43 @@ AUTH_PASSWORD_VALIDATORS = [
|
|
|
185
164
|
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
|
186
165
|
]
|
|
187
166
|
|
|
188
|
-
APIS_BASE_URI = "TO CHANGE"
|
|
189
|
-
|
|
190
|
-
APIS_MIN_CHAR = 0
|
|
191
167
|
|
|
192
168
|
# Internationalization
|
|
193
169
|
# https://docs.djangoproject.com/en/1.11/topics/i18n/
|
|
194
|
-
|
|
195
170
|
LANGUAGE_CODE = "en"
|
|
196
|
-
|
|
197
171
|
TIME_ZONE = "UTC"
|
|
198
|
-
|
|
199
172
|
USE_I18N = True
|
|
200
|
-
|
|
201
173
|
USE_L10N = True
|
|
202
|
-
|
|
203
174
|
USE_TZ = True
|
|
204
175
|
|
|
205
|
-
|
|
206
176
|
# Static files (CSS, JavaScript, Images)
|
|
207
177
|
# https://docs.djangoproject.com/en/1.11/howto/static-files/
|
|
208
|
-
|
|
209
178
|
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles/")
|
|
210
179
|
STATIC_URL = "/static/"
|
|
211
180
|
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
|
|
212
181
|
MEDIA_URL = "/media/"
|
|
213
182
|
|
|
183
|
+
# django-tables2 setting
|
|
184
|
+
# https://django-tables2.readthedocs.io/en/latest/pages/custom-rendering.html#available-templates
|
|
214
185
|
DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap4.html"
|
|
215
186
|
|
|
187
|
+
# apis-core-rdf settings
|
|
188
|
+
APIS_BASE_URI = "TO CHANGE"
|
|
189
|
+
APIS_MIN_CHAR = 0
|
|
216
190
|
APIS_NEXT_PREV = True
|
|
217
|
-
APIS_API_EXCLUDE_SETS = True # exclude reverse links to entities
|
|
218
191
|
APIS_LIST_VIEWS_ALLOWED = False
|
|
219
192
|
APIS_DETAIL_VIEWS_ALLOWED = False
|
|
220
|
-
|
|
193
|
+
SHARED_URL = "https://shared.acdh.oeaw.ac.at/"
|
|
221
194
|
|
|
195
|
+
# django-allow-cidr settings
|
|
196
|
+
# https://github.com/mozmeao/django-allow-cidr
|
|
222
197
|
ALLOWED_CIDR_NETS = ["10.0.0.0/8", "127.0.0.0/8"]
|
|
223
198
|
|
|
199
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases
|
|
200
|
+
# https://github.com/jazzband/dj-database-url
|
|
224
201
|
DATABASES = {'default': dj_database_url.config(default='sqlite:///db.sqlite3', conn_max_age=600)}
|
|
225
202
|
|
|
203
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#allowed-hosts
|
|
226
204
|
ALLOWED_HOSTS = ["localhost", "127.0.0.1"]
|
|
227
205
|
if os.environ.get("PUBLIC_URL"):
|
|
228
206
|
ALLOWED_HOSTS.append(re.sub(r"https?://", "", os.environ.get("PUBLIC_URL")))
|
|
@@ -230,11 +208,35 @@ if os.environ.get("PUBLIC_URL"):
|
|
|
230
208
|
if os.environ.get("ALLOWED_HOSTS"):
|
|
231
209
|
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS").split(",")
|
|
232
210
|
|
|
211
|
+
# setting of apis_acdhch_default_settings.ldapauth
|
|
233
212
|
if os.environ.get("AUTH_LDAP_USER_LIST", False):
|
|
234
213
|
AUTH_LDAP_SERVER_URI = os.environ.get("ARZ_AUTH_LDAP_SERVER_URI")
|
|
235
214
|
AUTH_LDAP_USER_DN_TEMPLATE = "%(user)s@oeaw.ads"
|
|
236
215
|
|
|
216
|
+
# https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-AUTHENTICATION_BACKENDS
|
|
237
217
|
AUTHENTICATION_BACKENDS = [
|
|
238
218
|
"apis_acdhch_default_settings.ldapauth.CustomLDAPBackend",
|
|
239
219
|
"django.contrib.auth.backends.ModelBackend",
|
|
240
220
|
]
|
|
221
|
+
|
|
222
|
+
# https://docs.djangoproject.com/en/5.0/howto/logging/
|
|
223
|
+
# setup logging to log everything to stdout
|
|
224
|
+
LOGGING = {
|
|
225
|
+
"version": 1,
|
|
226
|
+
"disable_existing_loggers": False,
|
|
227
|
+
'formatters': {
|
|
228
|
+
'verbose': {
|
|
229
|
+
'format': '%(asctime)s %(name)-6s %(levelname)-8s %(message)s',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
"handlers": {
|
|
233
|
+
"console": {
|
|
234
|
+
"class": "logging.StreamHandler",
|
|
235
|
+
"formatter": "verbose",
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
"root": {
|
|
239
|
+
"handlers": ["console"],
|
|
240
|
+
"level": "DEBUG",
|
|
241
|
+
},
|
|
242
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|