12345678910111213141516171819202122 |
- from flask import render_template, Blueprint, request, redirect, url_for
- import requests
- from backstage.utils.routes import update_manage_table
- home_app = Blueprint('home', __name__)
- @home_app.route('/backstage/home')
- def home():
- response = requests.get('http://127.0.0.1:5000/api/home')
- if response.status_code == 200:
- return render_template('home.html',
- title='首頁',
- form_url='home.update',
- page='home',
- contents=response.json())
- @home_app.route('/backstage/home/update', methods=['POST'])
- def update():
- update_manage_table(request.form, request.args, request.files, 'home2')
- return redirect(url_for('home.home'))
|