我被困在使用AWS和wsgi生产目的启动网站的过程中,建议我如何解决此问题

时间:2019-05-07 18:25:48

标签: flask hosting

generatequestion是将返回一个问题字典和答案列表的函数。问题是我已经使其可以全局访问,因此我可以在整个代码中使用数据,但是问题是当我托管站点500时由于这些行而出现错误,请帮助解决问题

def generatequestion():
    path = "AWS.xlsx"
    wb_obj = openpyxl.load_workbook(path)
    sheet_obj1 = wb_obj.get_sheet_by_name('Sheet3')
    sheet_obj2 = wb_obj.get_sheet_by_name('Sheet2')
    sheet_obj3 = wb_obj.get_sheet_by_name('Sheet1')
    l = {}
    c = 1
    answer1 = []
    set1 = rd.sample(range(2, 32), 10)
    set2 = rd.sample(range(2, 32), 10)
    set3 = rd.sample(range(2, 22), 10)
    for j in range(1, 4):
        if (j == 1):
            for i in set1:
                l[sheet_obj1.cell(row=i, column=1).value] = 
[sheet_obj1.cell(row=i, column=2).value,

sheet_obj1.cell(row=i, column=3).value,

sheet_obj1.cell(row=i, column=4).value,

sheet_obj1.cell(row=i, column=5).value]
                answer1.append(sheet_obj1.cell(row=i, column=6).value)
        if (j == 2):
            for i in set2:
                l[sheet_obj2.cell(row=i, column=1).value] = [sheet_obj2.cell(row=i, column=2).value,
                                                         sheet_obj2.cell(row=i, column=3).value,
                                                         sheet_obj2.cell(row=i, column=4).value,
                                                         sheet_obj2.cell(row=i, column=5).value]
            answer1.append(sheet_obj2.cell(row=i, column=6).value)
        if (j == 3):
            for i in set3:
                l[sheet_obj3.cell(row=i, column=1).value] = [sheet_obj3.cell(row=i, column=2).value,
                                                         sheet_obj3.cell(row=i, column=3).value,
                                                         sheet_obj3.cell(row=i, column=4).value,
                                                         sheet_obj3.cell(row=i, column=5).value]
            answer1.append(sheet_obj3.cell(row=i, column=6).value)

    return l,answer1









questiolist1,questiolist2,questiolist3,questiolist4,questiolist5,questiolist6={},{},{},{},{},{}
answer1,answer2,answer3,answer4,answer5,answer6=[],[],[],[],[],[]
questiolist6, answer6 = generatequestion()
questiolist5, answer5 = generatequestion()
questiolist4, answer4 = generatequestion()
questiolist3, answer3 = generatequestion()
questiolist2, answer2 = generatequestion()
questiolist1, answer1 = generatequestion()

0 个答案:

没有答案