apis-acdhch-default-settings 0.1.12__py3-none-any.whl
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/__init__.py +0 -0
- apis_acdhch_default_settings/settings.py +313 -0
- apis_acdhch_default_settings/urls.py +27 -0
- apis_acdhch_default_settings-0.1.12.dist-info/METADATA +17 -0
- apis_acdhch_default_settings-0.1.12.dist-info/RECORD +6 -0
- apis_acdhch_default_settings-0.1.12.dist-info/WHEEL +4 -0
|
File without changes
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from typing import Any, Dict
|
|
3
|
+
|
|
4
|
+
if os.environ.get("SENTRY_DSN"):
|
|
5
|
+
import sentry_sdk
|
|
6
|
+
from sentry_sdk.integrations.django import DjangoIntegration
|
|
7
|
+
|
|
8
|
+
sentry_sdk.init(
|
|
9
|
+
dsn=os.environ.get("SENTRY_DSN"),
|
|
10
|
+
integrations=[
|
|
11
|
+
DjangoIntegration(),
|
|
12
|
+
],
|
|
13
|
+
environment="production",
|
|
14
|
+
# we disable tracing by default
|
|
15
|
+
enable_tracing=False,
|
|
16
|
+
|
|
17
|
+
# If you wish to associate users to errors (assuming you are using
|
|
18
|
+
# django.contrib.auth) you may enable sending PII data.
|
|
19
|
+
send_default_pii=True,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
# We fall back to a DEFAULT_SECRET_KEY, but you should
|
|
23
|
+
# override this using an environment variable!
|
|
24
|
+
DEFAULT_SECRET_KEY = "a+nkut46lzzg_=ul)zrs29$u_6^*)2by2mjmwn)tqlgw)_at&l"
|
|
25
|
+
SECRET_KEY = os.environ.get("SECRET_KEY", DEFAULT_SECRET_KEY)
|
|
26
|
+
|
|
27
|
+
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
|
28
|
+
BASE_DIR = os.path.dirname(
|
|
29
|
+
os.path.dirname(os.path.abspath(os.path.join(__file__, "../")))
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
SHARED_URL = "https://shared.acdh.oeaw.ac.at/"
|
|
33
|
+
|
|
34
|
+
PROJECT_NAME = "apis"
|
|
35
|
+
PROJECT_SHARED = "https://shared.acdh.oeaw.ac.at/apis/"
|
|
36
|
+
PROJECT_DEFAULT_MD = {
|
|
37
|
+
"title": "TITLE",
|
|
38
|
+
"author": "Matthias Schlögl, Peter Andorfer",
|
|
39
|
+
"subtitle": "SUBTITLE",
|
|
40
|
+
"description": """This is a default metadata file. To change this, provide\
|
|
41
|
+
provide a following file {PROJECT_SHARED}/{PROJECT_NAME}/metadata.json""",
|
|
42
|
+
"github": "https://github.com/acdh-oeaw/apis-webpage-base",
|
|
43
|
+
"production instance": None,
|
|
44
|
+
"purpose_de": "",
|
|
45
|
+
"purpose_en": """""",
|
|
46
|
+
"version": ["apis_core", "charts", "django"],
|
|
47
|
+
"matomo_id": "",
|
|
48
|
+
"matomo_url": "",
|
|
49
|
+
"imprint": "/imprint",
|
|
50
|
+
"social_media": [
|
|
51
|
+
("fab fa-twitter", "https://twitter.com/ACDH_OeAW"),
|
|
52
|
+
("fab fa-youtube", "https://www.youtube.com/channel/UCgaEMaMbPkULYRI5u6gvG-w"),
|
|
53
|
+
],
|
|
54
|
+
"social_media": [
|
|
55
|
+
("fab fa-twitter fa-2x", "https://twitter.com/ACDH_OeAW"),
|
|
56
|
+
(
|
|
57
|
+
"fab fa-youtube fa-2x",
|
|
58
|
+
"https://www.youtube.com/channel/UCgaEMaMbPkULYRI5u6gvG-w",
|
|
59
|
+
),
|
|
60
|
+
],
|
|
61
|
+
"app_type": "database",
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Application definition
|
|
65
|
+
|
|
66
|
+
INSTALLED_APPS = [
|
|
67
|
+
"dal",
|
|
68
|
+
# 'corsheaders',
|
|
69
|
+
"dal_select2",
|
|
70
|
+
"django.contrib.admin",
|
|
71
|
+
"django.contrib.auth",
|
|
72
|
+
"django.contrib.contenttypes",
|
|
73
|
+
"django.contrib.sessions",
|
|
74
|
+
"django.contrib.messages",
|
|
75
|
+
"django.contrib.staticfiles",
|
|
76
|
+
"reversion",
|
|
77
|
+
"crispy_forms",
|
|
78
|
+
"django_filters",
|
|
79
|
+
"django_tables2",
|
|
80
|
+
"rest_framework",
|
|
81
|
+
"apis_core.core",
|
|
82
|
+
"apis_core.apis_entities",
|
|
83
|
+
"apis_core.apis_metainfo",
|
|
84
|
+
"apis_core.apis_relations",
|
|
85
|
+
"apis_core.apis_vocabularies",
|
|
86
|
+
"apis_core.apis_labels",
|
|
87
|
+
"rest_framework.authtoken",
|
|
88
|
+
# "drf_yasg",
|
|
89
|
+
"drf_spectacular",
|
|
90
|
+
"csvexport",
|
|
91
|
+
"apis_ontology",
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
# put apis_override_select2js at the beginning of the list
|
|
95
|
+
# to make its static files weigh more than from the other apps
|
|
96
|
+
INSTALLED_APPS = ["apis_override_select2js"] + INSTALLED_APPS
|
|
97
|
+
|
|
98
|
+
USE_X_FORWARDED_HOST = True
|
|
99
|
+
SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
|
|
100
|
+
CORS_ORIGIN_ALLOW_ALL = True
|
|
101
|
+
CORS_ALLOW_CREDENTIALS = True
|
|
102
|
+
CORS_ALLOW_METHODS = ("GET", "OPTIONS")
|
|
103
|
+
|
|
104
|
+
SPECTACULAR_SETTINGS: Dict[str, Any] = {
|
|
105
|
+
"TITLE": "APIS generic API",
|
|
106
|
+
"DESCRIPTIOPN": "Provides access to the main APIS data-model endpoints.",
|
|
107
|
+
"LICENSE": {"name": "MIT License", "url": "https://www.mit.edu/~amini/LICENSE.md"},
|
|
108
|
+
"VERSION": "0.13",
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
CSP_DEFAULT_SRC = (
|
|
113
|
+
"'self'",
|
|
114
|
+
"'unsafe-inline'",
|
|
115
|
+
"cdnjs.cloudflare.com",
|
|
116
|
+
"cdn.jsdelivr.net",
|
|
117
|
+
"fonts.googleapis.com",
|
|
118
|
+
"ajax.googleapis.com",
|
|
119
|
+
"cdn.rawgit.com",
|
|
120
|
+
"*.acdh.oeaw.ac.at",
|
|
121
|
+
"unpkg.com",
|
|
122
|
+
"fonts.gstatic.com",
|
|
123
|
+
"cdn.datatables.net",
|
|
124
|
+
"code.highcharts.com",
|
|
125
|
+
"*.acdh-dev.oeaw.ac.at",
|
|
126
|
+
"*.acdh.oeaw.ac.at",
|
|
127
|
+
"openstreetmap.org",
|
|
128
|
+
"*.openstreetmap.org",
|
|
129
|
+
)
|
|
130
|
+
CSP_FRAME_SRC = ("sennierer.github.io",)
|
|
131
|
+
|
|
132
|
+
CRISPY_TEMPLATE_PACK = "bootstrap3"
|
|
133
|
+
|
|
134
|
+
REST_FRAMEWORK = {
|
|
135
|
+
"DEFAULT_PAGINATION_CLASS": "rest_framework.pagination.LimitOffsetPagination",
|
|
136
|
+
"PAGE_SIZE": 50,
|
|
137
|
+
"DEFAULT_PERMISSION_CLASSES": (
|
|
138
|
+
# "rest_framework.permissions.DjangoModelPermissions",
|
|
139
|
+
# "rest_framework.permissions.IsAuthenticated",
|
|
140
|
+
"rest_framework.permissions.DjangoObjectPermissions",
|
|
141
|
+
# use IsAuthenticated for every logged in user to have global edit rights
|
|
142
|
+
),
|
|
143
|
+
"DEFAULT_AUTHENTICATION_CLASSES": (
|
|
144
|
+
"rest_framework.authentication.TokenAuthentication",
|
|
145
|
+
"rest_framework.authentication.SessionAuthentication",
|
|
146
|
+
"rest_framework.authentication.BasicAuthentication",
|
|
147
|
+
),
|
|
148
|
+
"DEFAULT_FILTER_BACKENDS": (
|
|
149
|
+
"django_filters.rest_framework.DjangoFilterBackend",
|
|
150
|
+
# "drf_spectacular.contrib.django_filters.DjangoFilterBackend",
|
|
151
|
+
),
|
|
152
|
+
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
AUTHENTICATION_BACKENDS = (
|
|
156
|
+
"django.contrib.auth.backends.ModelBackend", # this is default
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
MIDDLEWARE = [
|
|
160
|
+
"allow_cidr.middleware.AllowCIDRMiddleware",
|
|
161
|
+
"corsheaders.middleware.CorsMiddleware",
|
|
162
|
+
"django.middleware.security.SecurityMiddleware",
|
|
163
|
+
"whitenoise.middleware.WhiteNoiseMiddleware",
|
|
164
|
+
"django.contrib.sessions.middleware.SessionMiddleware",
|
|
165
|
+
"django.middleware.common.CommonMiddleware",
|
|
166
|
+
"django.middleware.csrf.CsrfViewMiddleware",
|
|
167
|
+
"django.contrib.auth.middleware.AuthenticationMiddleware",
|
|
168
|
+
"django.contrib.messages.middleware.MessageMiddleware",
|
|
169
|
+
"csp.middleware.CSPMiddleware",
|
|
170
|
+
"reversion.middleware.RevisionMiddleware",
|
|
171
|
+
"crum.CurrentRequestUserMiddleware",
|
|
172
|
+
]
|
|
173
|
+
|
|
174
|
+
ROOT_URLCONF = "apis-achdch-default-settings.urls"
|
|
175
|
+
|
|
176
|
+
TEMPLATES = [
|
|
177
|
+
{
|
|
178
|
+
"BACKEND": "django.template.backends.django.DjangoTemplates",
|
|
179
|
+
"DIRS": [os.path.join(BASE_DIR, "apis_ontology", "templates")],
|
|
180
|
+
"APP_DIRS": True,
|
|
181
|
+
"OPTIONS": {
|
|
182
|
+
"context_processors": [
|
|
183
|
+
"django.template.context_processors.debug",
|
|
184
|
+
"django.template.context_processors.request",
|
|
185
|
+
"django.contrib.auth.context_processors.auth",
|
|
186
|
+
"django.contrib.messages.context_processors.messages",
|
|
187
|
+
"apis_core.context_processors.custom_context_processors.list_entities",
|
|
188
|
+
"apis_core.context_processors.custom_context_processors.list_relations",
|
|
189
|
+
"apis_core.context_processors.custom_context_processors.list_apis_settings",
|
|
190
|
+
]
|
|
191
|
+
},
|
|
192
|
+
}
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
# Password validation
|
|
196
|
+
# https://docs.djangoproject.com/en/1.11/ref/settings/#auth-password-validators
|
|
197
|
+
|
|
198
|
+
AUTH_PASSWORD_VALIDATORS = [
|
|
199
|
+
{
|
|
200
|
+
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator"
|
|
201
|
+
},
|
|
202
|
+
{"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator"},
|
|
203
|
+
{"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator"},
|
|
204
|
+
{"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator"},
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
APIS_BASE_URI = "TO CHANGE"
|
|
208
|
+
|
|
209
|
+
APIS_MIN_CHAR = 0
|
|
210
|
+
|
|
211
|
+
# Internationalization
|
|
212
|
+
# https://docs.djangoproject.com/en/1.11/topics/i18n/
|
|
213
|
+
|
|
214
|
+
LANGUAGE_CODE = "en"
|
|
215
|
+
|
|
216
|
+
TIME_ZONE = "UTC"
|
|
217
|
+
|
|
218
|
+
USE_I18N = True
|
|
219
|
+
|
|
220
|
+
USE_L10N = True
|
|
221
|
+
|
|
222
|
+
USE_TZ = True
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# Static files (CSS, JavaScript, Images)
|
|
226
|
+
# https://docs.djangoproject.com/en/1.11/howto/static-files/
|
|
227
|
+
|
|
228
|
+
STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles/")
|
|
229
|
+
STATIC_URL = "/static/"
|
|
230
|
+
MEDIA_ROOT = os.path.join(BASE_DIR, "media/")
|
|
231
|
+
MEDIA_URL = "/media/"
|
|
232
|
+
|
|
233
|
+
DJANGO_TABLES2_TEMPLATE = "django_tables2/bootstrap4.html"
|
|
234
|
+
|
|
235
|
+
APIS_COMPONENTS = []
|
|
236
|
+
# APIS settings
|
|
237
|
+
|
|
238
|
+
APIS_TEI_TEXTS = ["xml/tei transcription"]
|
|
239
|
+
APIS_CETEICEAN_CSS = "https://teic.github.io/CETEIcean/css/CETEIcean.css"
|
|
240
|
+
APIS_CETEICEAN_JS = "https://teic.github.io/CETEIcean/js/CETEI.js"
|
|
241
|
+
|
|
242
|
+
APIS_NEXT_PREV = True
|
|
243
|
+
|
|
244
|
+
APIS_ALTERNATE_NAMES = [
|
|
245
|
+
"Taufname",
|
|
246
|
+
"Ehename",
|
|
247
|
+
"Name laut ÖBL XML",
|
|
248
|
+
"alternative Namensform",
|
|
249
|
+
"alternative name",
|
|
250
|
+
"Künstlername",
|
|
251
|
+
"Mädchenname",
|
|
252
|
+
"Pseudonym",
|
|
253
|
+
"weitere Namensform",
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
APIS_RELATIONS_FILTER_EXCLUDE = [
|
|
257
|
+
"*uri*",
|
|
258
|
+
"*tempentityclass*",
|
|
259
|
+
"user",
|
|
260
|
+
"*__id",
|
|
261
|
+
"*source*",
|
|
262
|
+
"label",
|
|
263
|
+
"*temp_entity*",
|
|
264
|
+
"*collection*",
|
|
265
|
+
"*published*",
|
|
266
|
+
"*_set",
|
|
267
|
+
"*_set__*",
|
|
268
|
+
"_ptr",
|
|
269
|
+
"baseclass",
|
|
270
|
+
"*id",
|
|
271
|
+
"*written*",
|
|
272
|
+
"relation_type__*",
|
|
273
|
+
"*__text*",
|
|
274
|
+
"text*",
|
|
275
|
+
"*annotation_set_relation*",
|
|
276
|
+
"*start_start_date*",
|
|
277
|
+
"*end_end_date*",
|
|
278
|
+
"*start_end_date*",
|
|
279
|
+
"*end_start_date*",
|
|
280
|
+
"*label*",
|
|
281
|
+
"*review*",
|
|
282
|
+
"*__name",
|
|
283
|
+
"*__status",
|
|
284
|
+
"*__references",
|
|
285
|
+
"*__notes",
|
|
286
|
+
]
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
APIS_VOCABULARIES = {"exclude": ["userAdded"]}
|
|
291
|
+
|
|
292
|
+
APIS_METAINFO = {"exclude": ["groups_allowed"]}
|
|
293
|
+
|
|
294
|
+
# TODO RDF: Remove this dictionary from settings entirely and attach it only to entity models
|
|
295
|
+
APIS_ENTITIES = {}
|
|
296
|
+
|
|
297
|
+
APIS_API_EXCLUDE_SETS = True # exclude reverse links to entities
|
|
298
|
+
|
|
299
|
+
APIS_LIST_VIEWS_ALLOWED = False
|
|
300
|
+
APIS_DETAIL_VIEWS_ALLOWED = False
|
|
301
|
+
MAX_AGE = 60 * 60
|
|
302
|
+
|
|
303
|
+
APIS_IIIF_WORK_KIND = "IIIF"
|
|
304
|
+
APIS_IIIF_ENT_IIIF_REL = "has iiif image"
|
|
305
|
+
APIS_IIIF_SERVER = "https://iiif.acdh.oeaw.ac.at/"
|
|
306
|
+
APIS_OSD_JS = (
|
|
307
|
+
"https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.0/openseadragon.min.js"
|
|
308
|
+
)
|
|
309
|
+
APIS_OSD_IMG_PREFIX = (
|
|
310
|
+
"https://cdnjs.cloudflare.com/ajax/libs/openseadragon/2.4.0/images/"
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
ALLOWED_CIDR_NETS = ["10.0.0.0/8", "127.0.0.0/8"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from django.conf import settings
|
|
2
|
+
from django.urls import include
|
|
3
|
+
from django.contrib import admin
|
|
4
|
+
from django.urls import path
|
|
5
|
+
from django.views.generic import TemplateView
|
|
6
|
+
|
|
7
|
+
from apis_core.apis_entities.api_views import GetEntityGeneric
|
|
8
|
+
|
|
9
|
+
urlpatterns = [
|
|
10
|
+
path("apis/", include("apis_core.urls", namespace="apis")),
|
|
11
|
+
path("api-auth/", include("rest_framework.urls", namespace="rest_framework")),
|
|
12
|
+
path(
|
|
13
|
+
"entity/<int:pk>/", GetEntityGeneric.as_view(), name="GetEntityGenericRoot"
|
|
14
|
+
),
|
|
15
|
+
path("admin/", admin.site.urls),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
if "webpage" in settings.INSTALLED_APPS:
|
|
19
|
+
urlpatterns.append(path("", include("webpage.urls", namespace="webpage")))
|
|
20
|
+
handler404 = "webpage.views.handler404"
|
|
21
|
+
|
|
22
|
+
if "apis_bibsonomy" in settings.INSTALLED_APPS:
|
|
23
|
+
urlpatterns.append(
|
|
24
|
+
path("bibsonomy/", include("apis_bibsonomy.urls", namespace="bibsonomy"))
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
urlpatterns.append(path("", TemplateView.as_view(template_name="base.html")))
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: apis-acdhch-default-settings
|
|
3
|
+
Version: 0.1.12
|
|
4
|
+
Summary: Default settings for APIS instances at the ACDH-CH
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Birger Schacht
|
|
7
|
+
Author-email: birger.schacht@oeaw.ac.at
|
|
8
|
+
Requires-Python: >=3.11,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Requires-Dist: dj-database-url (>=2.0.0,<3.0.0)
|
|
14
|
+
Requires-Dist: django-allow-cidr (>=0.6.0,<0.7.0)
|
|
15
|
+
Requires-Dist: django-csp (>=3.7,<4.0)
|
|
16
|
+
Requires-Dist: sentry-sdk (>=1.26.0,<2.0.0)
|
|
17
|
+
Requires-Dist: whitenoise (>=5.2.0,<6.0.0)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
apis_acdhch_default_settings/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
apis_acdhch_default_settings/settings.py,sha256=CZ_n5RCXIwGEdmlxgsMChXpRNTQBnmLNUiTBn88P3eE,9159
|
|
3
|
+
apis_acdhch_default_settings/urls.py,sha256=VDvjdb940573U-xuwGYwYZTJJRgTeSgnlNCm7Hj8kGs,946
|
|
4
|
+
apis_acdhch_default_settings-0.1.12.dist-info/METADATA,sha256=gsRaXhjg5krhkJ3GAuIWCwmuE-79knTCSEN6iGr7EKY,663
|
|
5
|
+
apis_acdhch_default_settings-0.1.12.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
6
|
+
apis_acdhch_default_settings-0.1.12.dist-info/RECORD,,
|