From cfc948ded4617da97d368cc053ed28a119a521ef Mon Sep 17 00:00:00 2001 From: janmax <j.michal@stud.uni-goettingen.de> Date: Thu, 30 Nov 2017 13:07:36 +0100 Subject: [PATCH] Added dummy html file and removed unused settings --- Dockerfile | 8 +++++--- backend/.gitignore | 33 --------------------------------- core/templates/index.html | 9 +++++++++ core/urls.py | 2 ++ grady/settings/default.py | 12 ------------ util/factories.py | 3 ++- util/importer.py | 3 +-- 7 files changed, 19 insertions(+), 51 deletions(-) delete mode 100644 backend/.gitignore create mode 100644 core/templates/index.html diff --git a/Dockerfile b/Dockerfile index 6fa59a78..32f12199 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 86ca4a48..00000000 --- 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 00000000..2377f17c --- /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 e64d5297..c431ec74 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 fce62a6f..d69a9b30 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 3d2edef2..a4161cfd 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 1fbbbb77..d6f30804 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' -- GitLab