Skip to content

Commit 60de491

Browse files
Merge pull request #21 from CentreForDigitalHumanities/feature/problems-in-db
Feature/problems in db
2 parents 6236de9 + 84bfdcd commit 60de491

25 files changed

Lines changed: 433 additions & 62 deletions

backend/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@ venv/
3131
ENV/
3232
env.bak/
3333
venv.bak/
34+
35+
# Data files
36+
problem/data/*

backend/example/apps.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

backend/example/models.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

backend/example/views.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

backend/langpro_annotator/common_settings.py

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@
1616
# cf. https://github.com/iMerica/dj-rest-auth/pull/110.
1717
'allauth.socialaccount',
1818
'user',
19-
2019
'revproxy',
21-
'example'
20+
'problem',
2221
]
2322

2423
MIDDLEWARE = [
@@ -67,4 +66,38 @@
6766

6867
REST_AUTH = {
6968
"USER_DETAILS_SERIALIZER": "user.serializers.CustomUserDetailsSerializer",
70-
}
69+
}
70+
71+
LOGGING = {
72+
"version": 1,
73+
"disable_existing_loggers": False,
74+
"formatters": {
75+
"verbose": {
76+
"format": "{levelname} {asctime} {module} {message}",
77+
"style": "{",
78+
},
79+
"simple": {
80+
"format": "{levelname} {message}",
81+
"style": "{",
82+
},
83+
},
84+
"handlers": {
85+
"console": {
86+
"level": "INFO",
87+
"class": "logging.StreamHandler",
88+
"formatter": "simple",
89+
},
90+
},
91+
"loggers": {
92+
"django": {
93+
"handlers": ["console"],
94+
"level": "INFO",
95+
"propagate": False,
96+
},
97+
"LangProAnnotator": {
98+
"handlers": ["console"],
99+
"level": "INFO",
100+
"propagate": False,
101+
},
102+
},
103+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import logging
2+
3+
logger = logging.getLogger('LangProAnnotator')

backend/langpro_annotator/proxy_frontend.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
from django.views.decorators.csrf import ensure_csrf_cookie
33

44
from revproxy.views import ProxyView
5+
56
view = ProxyView.as_view(upstream=settings.PROXY_FRONTEND)
67

8+
79
@ensure_csrf_cookie
810
def proxy_frontend(*args, **kwargs):
9-
""" Wrapper for calls to the SPA ensuring the precense of a CSRF cookie."""
11+
"""Wrapper for calls to the SPA ensuring the presence of a CSRF cookie."""
1012
global view
1113
return view(*args, **kwargs)

backend/langpro_annotator/urls.py

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
1. Import the include() function: from django.conf.urls import include, path
1414
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1515
"""
16+
1617
from django.conf import settings
1718
from django.urls import path, re_path, include
1819
from django.contrib import admin
@@ -24,28 +25,28 @@
2425
from .proxy_frontend import proxy_frontend
2526
from .i18n import i18n
2627

27-
from example.views import hooray as ExampleView # DELETEME, see below
28-
2928
api_router = routers.DefaultRouter() # register viewsets with this router
3029

3130

3231
if settings.PROXY_FRONTEND:
33-
spa_url = re_path(r'^(?P<path>.*)$', proxy_frontend)
32+
spa_url = re_path(r"^(?P<path>.*)$", proxy_frontend)
3433
else:
35-
spa_url = re_path(r'', index)
34+
spa_url = re_path(r"", index)
3635

3736
urlpatterns = [
38-
path('api/example/', ExampleView), # this is just an example, please delete and utilize router above.
39-
path('admin', RedirectView.as_view(url='/admin/', permanent=True)),
40-
path('api', RedirectView.as_view(url='/api/', permanent=True)),
41-
path('api-auth', RedirectView.as_view(url='/api-auth/', permanent=True)),
42-
path('admin/', admin.site.urls),
43-
path('api/', include(api_router.urls)),
44-
path('api-auth/', include(
45-
'rest_framework.urls',
46-
namespace='rest_framework',
47-
)),
48-
path('api/i18n/', i18n),path("users/", include("user.urls")),
49-
37+
path("admin", RedirectView.as_view(url="/admin/", permanent=True)),
38+
path("api", RedirectView.as_view(url="/api/", permanent=True)),
39+
path("api-auth", RedirectView.as_view(url="/api-auth/", permanent=True)),
40+
path("admin/", admin.site.urls),
41+
path("api/", include(api_router.urls)),
42+
path(
43+
"api-auth/",
44+
include(
45+
"rest_framework.urls",
46+
namespace="rest_framework",
47+
),
48+
),
49+
path("api/i18n/", i18n),
50+
path("users/", include("user.urls")),
5051
spa_url, # catch-all; unknown paths to be handled by a SPA
5152
]

0 commit comments

Comments
 (0)