我想创建一个简单的数据表计算器,它只是从html表单中获取数据,逐行添加来自google电子表格的列,并在与我的html表单相同的页面上输出一个新表 .

现在我尝试使用Flask-ex's template编写一个烧瓶应用程序,所以我可以显示我的数据,但我可以't. Even with flask' s调试器不输出任何错误 .

What do you think I should?

下面你会发现两个包含该代码的pastebins以及我如何尝试显示我的代码:

HTML

{{ans | safe}}
{{ans_factor | safe}}

Python

@app.route('/home', methods=['POST'])
def submit():

    #Set up the creds to access spreadsheet
    SCOPE = "https://www.googleapis.com/auth/drive"
    creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', SCOPE)
    client = gspread.authorize(creds)
    #Access the first page of our spreadsheet
    sheet = client.open('Survey_Responses').sheet1


    #Assign the data that we accessed from the previous line to a variable
    responses = sheet.get_all_records()
    resp_df=pd.DataFrame(responses) #Convert list to DataFrame
    resp_select_ans=resp_df.iloc[0,1:37] /10
    ans_factor=pd.DataFrame(resp_df.iloc[0:6,41])

    ans=resp_select_ans.values.reshape((6,6))
    return render_template('/home', ans=ans.to_html(),ans_factor=ans_factor.to_html())