Skip to content
Snippets Groups Projects
Commit 35979486 authored by Mia Wang's avatar Mia Wang
Browse files

react

parent f117547f
No related branches found
No related tags found
No related merge requests found
......@@ -207,4 +207,4 @@ celerybeat.pid
# user uplaod
/react_backend/child_networks
/react_backend/policy.txt
\ No newline at end of file
# /react_backend/policy.txt
\ No newline at end of file
......@@ -17,12 +17,12 @@ torch.manual_seed(0)
print('@@@ import successful')
app = Flask(__name__, static_folder='react_frontend/build', static_url_path='')
app = Flask(__name__, static_folder='react_frontend/build', static_url_path='/')
CORS(app)
# it is used to collect user input and store them in the app
@app.route('/home', methods=["GET", "POST"])
# @cross_origin
# @cross_origin()
def get_form_data():
print('@@@ in Flask Home')
# form_data = request.get_json()
......@@ -122,7 +122,7 @@ def get_form_data():
# ========================================================================
@app.route('/confirm', methods=['POST', 'GET'])
# @cross_origin
@cross_origin()
def confirm():
print('inside confirm page')
data = current_app.config['data']
......@@ -133,7 +133,7 @@ def confirm():
# ========================================================================
@app.route('/training', methods=['POST', 'GET'])
# @cross_origin
@cross_origin()
def training():
# default values
......@@ -158,7 +158,7 @@ def training():
# ========================================================================
@app.route('/result')
# @cross_origin
@cross_origin()
def show_result():
file_path = "./react_backend/policy.txt"
f = open(file_path, "r")
......@@ -167,7 +167,6 @@ def show_result():
@app.route('/')
# @cross_origin
def serve():
return send_from_directory(app.static_folder, 'index.html')
......
0.7018545454545454,0.6530636363636364,0.6565090909090909,0.7029727272727273,0.6615000000000001,0.6610181818181818,0.6333545454545454,0.6617909090909091,0.6584636363636364,0.6933909090909091
\ No newline at end of file
......@@ -15,7 +15,7 @@ class MyTestCase(unittest.TestCase):
self.app = react_app.app.test_client()
def test_home(self):
response = self.app.get('/home')
response = self.app.get('/')
def test_training(self):
response = self.app.get('/training')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment