routes.py 467 B

1234567891011121314
  1. from flask import render_template, Blueprint, request, redirect, url_for, flash
  2. import requests
  3. from collections import defaultdict
  4. home_app = Blueprint('home', __name__)
  5. @home_app.route('/backstage/home')
  6. def home():
  7. response = requests.get('http://127.0.0.1:5000/api/home')
  8. if response.status_code == 200:
  9. return render_template('home.html',
  10. title='首頁',
  11. contents=response.json())