Skip to content

Commit

Permalink
added localhost redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
JJFlorian committed Apr 8, 2024
1 parent e99ac5d commit 9d5271e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

urlpatterns = [
path("", views.APIOverview.as_view(), name="overview"),
path("localhost-redirect", views.LocalHostRedirectView.as_view(), name="localhost"),
path("gmn/", include(("gmn.urls", "gmn"), namespace="gmn")),
path("gmw/", include(("gmw.urls", "gmw"), namespace="gmw")),
path("importtasks/", views.ImportTaskListView.as_view(), name="importtask-list"),
Expand Down
12 changes: 12 additions & 0 deletions api/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
from django.contrib.auth import logout
from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.shortcuts import redirect
from django_filters.rest_framework import DjangoFilterBackend
from drf_yasg.utils import swagger_auto_schema
from rest_framework import generics, permissions, status, views, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.views import APIView

from . import filters, mixins, models, serializers, tasks

Expand Down Expand Up @@ -50,6 +52,16 @@ def get(self, request, format=None):
return Response(data)


class LocalHostRedirectView(APIView):
"""
View that redirects user to localhost:4200.
Is used for local frontend development on the stagin environment.
"""

def get(self, request, *args, **kwargs):
return HttpResponseRedirect("http://localhost:4200")


class UserViewSet(viewsets.ModelViewSet):
model = User
serializer_class = serializers.UserSerializer
Expand Down

0 comments on commit 9d5271e

Please sign in to comment.