Mise en place d'update
This commit is contained in:
parent
b195b5d17e
commit
3ba341b415
3 changed files with 13 additions and 8 deletions
|
@ -12,7 +12,7 @@ def create_app():
|
||||||
data=pd.read_csv("/Datasets/database/questions.csv",delimiter=",")
|
data=pd.read_csv("/Datasets/database/questions.csv",delimiter=",")
|
||||||
data.to_sql('questions',con,if_exists='replace',index=False)
|
data.to_sql('questions',con,if_exists='replace',index=False)
|
||||||
|
|
||||||
@app.route('/get_question/<int:id>/',methods=['GET'])
|
@app.route('/question/<int:id>/',methods=['GET'])
|
||||||
def get_question(id=1):
|
def get_question(id=1):
|
||||||
with sql.connect("/Datasets/database/database.db") as con:
|
with sql.connect("/Datasets/database/database.db") as con:
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
|
|
BIN
main/Dockerfiles/app/.entrypoint.sh.swp
Normal file
BIN
main/Dockerfiles/app/.entrypoint.sh.swp
Normal file
Binary file not shown.
|
@ -1,20 +1,25 @@
|
||||||
# app/__init__.py
|
# app/__init__.py
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
def create_app():
|
def create_app():
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/<string:id>')
|
@app.route('/update/<string:id>/<string:attr>/<int:value>/')
|
||||||
def create(id):
|
def update(id,attr,value):
|
||||||
import update_grid;
|
import update_grid;
|
||||||
path = "/Datasets/grids/"# PATH TO VOLUME
|
path = "/Datasets/grids/"# PATH TO VOLUME
|
||||||
|
r = requests.get("http://127.0.0.1:50011/update/"+id+"/"+attr+"/"+str(value)+"/")
|
||||||
|
print("Message",file=sys.stdout)
|
||||||
|
print(r,file=sys.stdout)
|
||||||
|
dict = r.json()
|
||||||
# TO DO
|
# TO DO
|
||||||
# GET COORDINATES x and y
|
# GET COORDINATES x and y
|
||||||
x = 0.3
|
nb_img = dict["Nb"]
|
||||||
y = 0.5
|
for x,y in dict["img"]:
|
||||||
nb_img = 24
|
update_grid.hide_image(path+id+".png", path+id+".png", float(x),float(y))
|
||||||
update_grid.hide_image(path+id+".png", path+id+".png", x,y)
|
|
||||||
return str(nb_img)
|
return str(nb_img)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
Loading…
Reference in a new issue