UPDATE

上级 18b13a78
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, render_template, jsonify
import dataset
from flask import Flask, render_template
app = Flask(__name__)
# 连接到SQLite数据库
db = dataset.connect('sqlite:///resources/urls.db')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/api/prompts')
def get_cards():
# 获取 cards 表中的所有数据
cards = db['cards'].all()
print(list(cards))
# 将数据转换为 JSON 格式,并返回
return jsonify(cards=list(cards))
if __name__ == '__main__':
app.run(debug=True,host="0.0.0.0",port=5001)
\ No newline at end of file
app.run(port=5002)
\ No newline at end of file
flask
dataset
\ No newline at end of file
flask
\ No newline at end of file
此差异已折叠。
文件已删除
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册