diff --git a/Dockerfile b/Dockerfile index 6fa59a781914466dd47aa797c516387b04d9ed13..32f1219921c30c46cd08d3ccddd62df9b99cffc8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # Build Python files FROM python:3.6 as python -COPY backend/requirements.txt . +COPY requirements.txt . RUN pip install -r requirements.txt RUN curl -s https://gitlab.gwdg.de/snippets/51/raw --output words @@ -25,11 +25,13 @@ RUN apk update \ && apk del build-deps RUN mkdir -p /usr/share/dict -WORKDIR /code/backend +WORKDIR /code COPY . /code COPY --from=python /root/.cache /root/.cache COPY --from=python /words /usr/share/dict/words -COPY --from=node /app/dist /code/backend/static +COPY --from=node /app/dist /code/static +COPY --from=node /app/dist/index.html /code/core/templates RUN pip install -r requirements.txt && rm -rf /root/.cache +RUN python manage.py collectstatic --noinput diff --git a/backend/.gitignore b/backend/.gitignore deleted file mode 100644 index 86ca4a4842208f80247e2f5f30648fa73444dabe..0000000000000000000000000000000000000000 --- a/backend/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -# python specific -*.egg-info -*.pot -*.py[co] -.tox/ -__pycache__ -MANIFEST -.coverage -cache/ -.mypy_cache/ - -# Django specific -dist/ -docs/_build/ -docs/locale/ -tests/coverage_html/ -tests/.coverage -build/ -tests/report/ -*.sqlite3 -static/ - -# project specific -env-grady/ -env/ -scripts/ -coverage_html/ -public/ -*.csv -.importer* - -# node -node_modules diff --git a/core/templates/index.html b/core/templates/index.html new file mode 100644 index 0000000000000000000000000000000000000000..2377f17c1c51b87f16bc4b2a6395d8cec56142db --- /dev/null +++ b/core/templates/index.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<html> +<head> + <title>Grady Frontend placeholder</title> +</head> +<body> +This is just a placeholder and will be replaced in production. +</body> +</html> diff --git a/core/urls.py b/core/urls.py index e64d529790c3f805c984de185817ff3983bb6fb4..c431ec7424b6b8a619b036d84764e9e90d00912f 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,5 +1,6 @@ from django.conf.urls import include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.views.generic.base import TemplateView from rest_framework.routers import DefaultRouter from rest_framework_jwt.views import obtain_jwt_token, refresh_jwt_token @@ -15,6 +16,7 @@ router.register(r'student-page', views.StudentSelfApiViewSet, base_name='student_page') urlpatterns = [ + url(r'^$', TemplateView.as_view(template_name='index.html'), name="home"), url(r'^api/', include(router.urls)), url(r'^api-token-auth/', obtain_jwt_token), url(r'^api-token-refresh', refresh_jwt_token), diff --git a/grady/settings/default.py b/grady/settings/default.py index fce62a6fea802a03f1088d3f634ef0a899a62c24..d69a9b30c7e8232b2ce392000f095bbcc47a191b 100644 --- a/grady/settings/default.py +++ b/grady/settings/default.py @@ -13,8 +13,6 @@ https://docs.djangoproject.com/en/1.10/ref/settings/ import datetime import os -from django.contrib.messages import constants as messages - # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname( os.path.dirname(os.path.abspath(__file__)))) @@ -124,16 +122,6 @@ GRAPH_MODELS = { LOGIN_REDIRECT_URL = '/' LOGIN_URL = '/' - -MESSAGE_TAGS = { - messages.DEBUG: 'alert-info', - messages.INFO: 'alert-info', - messages.SUCCESS: 'alert-success', - messages.WARNING: 'alert-warning', - messages.ERROR: 'alert-danger', -} - - AUTH_USER_MODEL = 'core.UserAccount' AUTH_PASSWORD_VALIDATORS = [] CORS_ORIGIN_WHITELIST = ( diff --git a/util/factories.py b/util/factories.py index 3d2edef2cc4f51ef9955fc878236dc7376282735..a4161cfd62634c76c0e3480571b4f0f421455c6a 100644 --- a/util/factories.py +++ b/util/factories.py @@ -1,7 +1,8 @@ import configparser import secrets -from core.models import UserAccount as User, Student, Tutor, Reviewer +from core.models import UserAccount as User +from core.models import Reviewer, Student, Tutor STUDENTS = 'students' TUTORS = 'tutors' diff --git a/util/importer.py b/util/importer.py index 1fbbbb770278e411183eb66b046b4f2461cf53bc..d6f3080403a80c7b6f08eaa4c8e9240aa38837b9 100644 --- a/util/importer.py +++ b/util/importer.py @@ -9,11 +9,10 @@ import util.processing from core.models import UserAccount as User from core.models import (ExamType, Feedback, Student, Submission, SubmissionType, Test) +from util.factories import REVIEWERS, STUDENTS, TUTORS, GradyUserFactory from util.messages import info, warn from util.processing import EmptyTest -from util.factories import STUDENTS, REVIEWERS, TUTORS, GradyUserFactory - HISTFILE = '.importer_history' RECORDS = '.importer' PASSWORDS = '.importer_passwords'