TianyiMoe/backend/randpic/views.py

9 lines
381 B
Python
Raw Normal View History

2024-04-27 07:50:22 +00:00
from django.shortcuts import render, redirect
from django.http import HttpResponse
2024-04-30 05:40:39 +00:00
from .random_picture import get_random_picture_url, get_random_picture_meta
import json
2024-04-27 07:50:22 +00:00
# Create your views here.
def index(request):
2024-04-30 05:40:39 +00:00
return redirect(get_random_picture_url())
def metadata(request):
return HttpResponse(json.dumps(get_random_picture_meta()), content_type="application/json")