From 5fda07a5c22fcdf3ab17aed4e1c0fb77301a7add Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Sun, 5 Jun 2022 19:53:22 +0200 Subject: [PATCH] Add workaround for vitejs resolving font path --- README.md | 22 ------------------- client/index.html | 8 +++++-- .../components/circle/LearningSequence.vue | 2 +- client/vite.config.ts | 2 +- server/config/settings/base.py | 2 +- server/vbv_lernwelt/core/views.py | 10 +++++++-- 6 files changed, 17 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 9b1affa6..56e6731c 100644 --- a/README.md +++ b/README.md @@ -89,25 +89,3 @@ npm install ![](docs/envfile_plugin_settings.png) #### Install the tailwind css Plugin from Jetbrains - - -## Wagtail API intro - -get all pages: - - http://localhost:8000/api/v2/pages/ - -get Analyse Circle (the one with the most demo data) - - http://localhost:8000/api/v2/pages/?title=Analyse - - -Get Circles only - - http://localhost:8000/api/v2/pages/?type=learnpath.Circle - -Get All Contents from that circle: - - http://localhost:8000/api/v2/pages/?child_of=11 - - diff --git a/client/index.html b/client/index.html index 595da947..11f9aef5 100644 --- a/client/index.html +++ b/client/index.html @@ -4,8 +4,12 @@ - Vite App - + + + + + + myVBV
diff --git a/client/src/components/circle/LearningSequence.vue b/client/src/components/circle/LearningSequence.vue index 7e2a3bbc..e1af43eb 100644 --- a/client/src/components/circle/LearningSequence.vue +++ b/client/src/components/circle/LearningSequence.vue @@ -33,7 +33,7 @@ defineProps(['learningSequence']) > -
{{ learningUnit.title }}
+
{{ learningUnit.contents[0].type }}: {{ learningUnit.title }}

diff --git a/client/vite.config.ts b/client/vite.config.ts index 0420dde0..6634ac33 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -23,7 +23,7 @@ export default ({mode}) => { // replacement: path.resolve(__dirname, './node_modules/vue-i18n/dist/vue-i18n.runtime.esm-bundler.js') // } // ] - }) + }), ], resolve: { alias: { diff --git a/server/config/settings/base.py b/server/config/settings/base.py index 34152070..15a65c39 100644 --- a/server/config/settings/base.py +++ b/server/config/settings/base.py @@ -462,7 +462,7 @@ CORS_URLS_REGEX = r"^/api/.*$" # See more configuration options at https://drf-spectacular.readthedocs.io/en/latest/settings.html#settings SPECTACULAR_SETTINGS = { "TITLE": "VBV Lernwelt API", - "DESCRIPTION": "Documentation of API endpoiints of VBV Lernwelt", + "DESCRIPTION": "Documentation of API endpoints of VBV Lernwelt", "VERSION": "1.0.0", "SERVE_PERMISSIONS": ["rest_framework.permissions.IsAdminUser"], "SERVERS": [ diff --git a/server/vbv_lernwelt/core/views.py b/server/vbv_lernwelt/core/views.py index 52d37736..29c9daa0 100644 --- a/server/vbv_lernwelt/core/views.py +++ b/server/vbv_lernwelt/core/views.py @@ -1,9 +1,11 @@ # Create your views here. + import requests from django.conf import settings from django.core.management import call_command from django.http import JsonResponse, HttpResponse, HttpResponseRedirect from django.shortcuts import render +from django.template import loader from django.views.decorators.csrf import ensure_csrf_cookie from ratelimit.decorators import ratelimit from rest_framework import authentication @@ -19,16 +21,20 @@ def vue_home(request): if settings.IT_SERVE_VUE: try: res = requests.get(f'{settings.IT_SERVE_VUE_URL}{request.get_full_path()}') + content = res.text + content = content.replace('https://vbv-lernwelt.control.iterativ.ch/static/', '/static/') headers = res.headers content_type = headers.get('content-type', 'text/html') - return HttpResponse(res.text, content_type=content_type) + return HttpResponse(content, content_type=content_type) except Exception as e: return HttpResponse( f'Can not connect to vue dev server at {settings.IT_SERVE_VUE_URL}: {e}' ) # render index.html from `npm run build` - return render(request, 'vue/index.html', {}) + content = loader.render_to_string('vue/index.html', context={}, request=request) + content = content.replace('https://vbv-lernwelt.control.iterativ.ch/static/', '/static/') + return HttpResponse(content) def permission_denied_view(request, exception):