diff --git a/compose/django/docker_start.sh b/compose/django/docker_start.sh index 05e535bd..cc6bffe0 100644 --- a/compose/django/docker_start.sh +++ b/compose/django/docker_start.sh @@ -4,15 +4,9 @@ set -o errexit set -o pipefail set -o nounset +python /app/manage.py collectstatic --noinput + # TODO remove after stabilisation python /app/manage.py reset_schema -python /app/manage.py collectstatic --noinput -python /app/manage.py createcachetable -python /app/manage.py migrate - -# TODO remove after stabilisation -python /app/manage.py create_default_users -python /app/manage.py create_default_learning_path - /usr/local/bin/gunicorn config.asgi --bind 0.0.0.0:80 --chdir=/app -k uvicorn.workers.UvicornWorker diff --git a/server/config/urls.py b/server/config/urls.py index 49992051..008d58a3 100644 --- a/server/config/urls.py +++ b/server/config/urls.py @@ -17,8 +17,7 @@ from vbv_lernwelt.core.middleware.auth import django_view_authentication_exempt from vbv_lernwelt.core.views import ( rate_limit_exceeded_view, permission_denied_view, - check_rate_limit, cypress_reset_view, vue_home, -) + check_rate_limit, cypress_reset_view, vue_home, ) from .wagtail_api import wagtail_api_router @@ -67,7 +66,7 @@ urlpatterns += [ if settings.APP_ENVIRONMENT != 'production': urlpatterns += [ - re_path(r'cypressreset/$', cypress_reset_view, name='cypress_reset_view'), + re_path(r'core/cypressreset/$', cypress_reset_view, name='cypress_reset_view'), ] # fmt: on diff --git a/server/vbv_lernwelt/core/management/commands/reset_schema.py b/server/vbv_lernwelt/core/management/commands/reset_schema.py index d4faa57d..bad46f70 100644 --- a/server/vbv_lernwelt/core/management/commands/reset_schema.py +++ b/server/vbv_lernwelt/core/management/commands/reset_schema.py @@ -1,5 +1,6 @@ import djclick as click from django.conf import settings +from django.core.management import call_command from django.db import transaction, connection @@ -24,3 +25,7 @@ def command(): print(user) reset_schema(db_config_user=user) + call_command('createcachetable') + call_command('migrate') + call_command('create_default_users') + call_command('create_default_learning_path') diff --git a/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py index 200a3f6f..e6a6f45e 100644 --- a/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py +++ b/server/vbv_lernwelt/learnpath/tests/create_default_learning_path.py @@ -5,7 +5,8 @@ from wagtail.models import Site, Page, Locale from wagtail_localize.models import LocaleSynchronization from vbv_lernwelt.core.admin import User -from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningContent +from vbv_lernwelt.learnpath.models import LearningPath, Topic, Circle, LearningSequence, LearningContent, LearningUnit, \ + LearningUnitQuestion from vbv_lernwelt.learnpath.tests.learning_path_factories import LearningPathFactory, TopicFactory, CircleFactory, \ LearningSequenceFactory, LearningContentFactory, VideoBlockFactory, PodcastBlockFactory, CompetenceBlockFactory, \ ExerciseBlockFactory, DocumentBlockFactory, LearningUnitFactory, LearningUnitQuestionFactory @@ -407,7 +408,6 @@ Fachspezialisten bei. # tp = TopicFactory.create(title="Prüfung", is_visible=False, learning_path=lp) # circle_7 = CircleFactory.create(title="Prüfungsvorbereitung", parent=lp, topic=tp) - # locales locale_de = Locale.objects.get(language_code='de-CH') locale_fr, _ = Locale.objects.get_or_create(language_code='fr-CH') @@ -421,13 +421,15 @@ Fachspezialisten bei. sync_from_id=locale_de.id ) call_command('sync_locale_trees') - + # all pages belong to 'admin' by default Page.objects.update(owner=user) def delete_default_learning_path(): LearningContent.objects.all().delete() + LearningUnitQuestion.objects.all().delete() + LearningUnit.objects.all().delete() LearningSequence.objects.all().delete() Circle.objects.all().delete() Topic.objects.all().delete() diff --git a/server/vbv_lernwelt/templates/admin/index.html b/server/vbv_lernwelt/templates/admin/index.html index 61e80fee..27e592a4 100644 --- a/server/vbv_lernwelt/templates/admin/index.html +++ b/server/vbv_lernwelt/templates/admin/index.html @@ -5,9 +5,13 @@ {% include "admin/app_list.html" with app_list=app_list show_changelinks=True %}