TianyiMoe/backend/randpic/views.py

9 lines
381 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 index(request):
return redirect(get_random_picture_url())
def metadata(request):
return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json")