TianyiMoe/backend/randpic/views.py

9 lines
394 B
Python

from django.shortcuts import render, redirect
from django.http import HttpResponse
from .random_picture import get_random_picture_url, get_random_picture_meta
import json
# Create your views here.
def redirect_view(request):
return redirect(get_random_picture_url())
def metadata_view(request):
return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json")