diff --git a/backend/randpic/urls.py b/backend/randpic/urls.py index fca3244..2f0dadf 100644 --- a/backend/randpic/urls.py +++ b/backend/randpic/urls.py @@ -3,6 +3,6 @@ from django.urls import path from . import views urlpatterns = [ - path("", views.index, name="index"), - path("metadata", views.metadata, name="metadata") + path("redirect", views.redirect_view, name="redirect"), + path("metadata", views.metadata_view, name="metadata") ] \ No newline at end of file diff --git a/backend/randpic/views.py b/backend/randpic/views.py index d5d6d45..1ca9404 100644 --- a/backend/randpic/views.py +++ b/backend/randpic/views.py @@ -3,7 +3,7 @@ from django.http import HttpResponse from .random_picture import get_random_picture_url, get_random_picture_meta import json # Create your views here. -def index(request): +def redirect_view(request): return redirect(get_random_picture_url()) -def metadata(request): +def metadata_view(request): return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json") \ No newline at end of file