modified url

This commit is contained in:
tianyi 2024-04-30 09:24:03 +00:00
parent e466466e04
commit 51986a13bd
2 changed files with 4 additions and 4 deletions

View File

@ -3,6 +3,6 @@ from django.urls import path
from . import views from . import views
urlpatterns = [ urlpatterns = [
path("", views.index, name="index"), path("redirect", views.redirect_view, name="redirect"),
path("metadata", views.metadata, name="metadata") path("metadata", views.metadata_view, name="metadata")
] ]

View File

@ -3,7 +3,7 @@ from django.http import HttpResponse
from .random_picture import get_random_picture_url, get_random_picture_meta from .random_picture import get_random_picture_url, get_random_picture_meta
import json import json
# Create your views here. # Create your views here.
def index(request): def redirect_view(request):
return redirect(get_random_picture_url()) 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") return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json")