//run.py
from flask import Flask, render_template, jsonify, request
from flask_cors import CORS
from src.models.models import Memeber0
from src.models.dbconn3 import db
app = Flask(name)
CORS(app)
@app.route('/json_test', methods=['GET', 'POST'])
def json_test():
if request.method == "POST":
index = jsonify(request.json.get('index'))
agency = jsonify(request.json.get('agency'))
name = jsonify(request.json.get('name'))
feature = jsonify(request.json.get('feature'))
depiction = jsonify(request.json.get('depiction'))
Memeber0.query.filter(Memeber0.index == index).update(dict(
agency=agency, name=name, feature=feature, depiction=depiction
))
db.session.commit()
return index
----------------------
I want to send a json from the front end and update it to the postgresql DB with that data.
But I did this, but I can not do it. What should I do?
I would like you to give us a simple example.
from flask import Flask, render_template, jsonify, request
from flask_cors import CORS
from src.models.models import Memeber0
from src.models.dbconn3 import db
app = Flask(name)
CORS(app)
@app.route('/json_test', methods=['GET', 'POST'])
def json_test():
if request.method == "POST":
index = jsonify(request.json.get('index'))
agency = jsonify(request.json.get('agency'))
name = jsonify(request.json.get('name'))
feature = jsonify(request.json.get('feature'))
depiction = jsonify(request.json.get('depiction'))
Memeber0.query.filter(Memeber0.index == index).update(dict(
agency=agency, name=name, feature=feature, depiction=depiction
))
db.session.commit()
return index
----------------------
I want to send a json from the front end and update it to the postgresql DB with that data.
But I did this, but I can not do it. What should I do?
I would like you to give us a simple example.