Improve provision of development assets

This commit is contained in:
Ramon Wenger 2021-02-24 15:15:45 +01:00
parent ff9938bd9d
commit 5a3badd38e
2 changed files with 7 additions and 8 deletions

View File

@ -27,7 +27,7 @@ from users.mutations import ProfileMutations
from registration.mutations_public import RegistrationMutations from registration.mutations_public import RegistrationMutations
class Query(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQuery, BookQuery, AssignmentsQuery, class CustomQuery(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQuery, BookQuery, AssignmentsQuery,
StudentSubmissionQuery, BasicKnowledgeQuery, PortfolioQuery, SurveysQuery, graphene.ObjectType): StudentSubmissionQuery, BasicKnowledgeQuery, PortfolioQuery, SurveysQuery, graphene.ObjectType):
node = relay.Node.Field() node = relay.Node.Field()
@ -35,11 +35,11 @@ class Query(UsersQuery, AllUsersQuery, ModuleRoomsQuery, RoomsQuery, ObjectivesQ
debug = graphene.Field(DjangoDebug, name='_debug') debug = graphene.Field(DjangoDebug, name='_debug')
class Mutation(BookMutations, RoomMutations, AssignmentMutations, ObjectiveMutations, CoreMutations, PortfolioMutations, class CustomMutation(BookMutations, RoomMutations, AssignmentMutations, ObjectiveMutations, CoreMutations, PortfolioMutations,
ProfileMutations, SurveyMutations, NoteMutations, RegistrationMutations, SpellCheckMutations, ProfileMutations, SurveyMutations, NoteMutations, RegistrationMutations, SpellCheckMutations,
CouponMutations, graphene.ObjectType): CouponMutations, graphene.ObjectType):
if settings.DEBUG: if settings.DEBUG:
debug = graphene.Field(DjangoDebug, name='_debug') debug = graphene.Field(DjangoDebug, name='_debug')
schema = graphene.Schema(query=Query, mutation=Mutation) schema = graphene.Schema(query=CustomQuery, mutation=CustomMutation)

View File

@ -1,15 +1,11 @@
import requests import requests
from django.conf import settings from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import PasswordResetView, PasswordResetDoneView, PasswordResetConfirmView, \
PasswordResetCompleteView
from django.http.response import HttpResponse from django.http.response import HttpResponse
from django.shortcuts import render from django.shortcuts import render
from django.urls import reverse_lazy
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import TemplateView from django.views.generic import TemplateView
from graphene_django.views import GraphQLView from graphene_django.views import GraphQLView
from django.utils.translation import gettext_lazy as _
from core.hep_client import HepClient from core.hep_client import HepClient
from core.models import AdminData from core.models import AdminData
@ -23,7 +19,10 @@ class PrivateGraphQLView(LoginRequiredMixin, GraphQLView):
def home(request): def home(request):
if settings.SERVE_VIA_WEBPACK: if settings.SERVE_VIA_WEBPACK:
try: try:
return HttpResponse(requests.get('http://localhost:8080/{}'.format(request.get_full_path())).text) res = requests.get('http://localhost:8080/{}'.format(request.get_full_path()))
headers = res.headers
content_type = headers.get('content-type', 'text/html')
return HttpResponse(res.text, content_type=content_type)
except Exception as e: except Exception as e:
print('Can not connect to dev server at http://localhost:8080:', e) print('Can not connect to dev server at http://localhost:8080:', e)