Linked Questions

Popular Questions

How do I fix 307 redirect from using Python Flask?

Asked by At

I'm creating a web page by using python flask. From the selection page, whenever user selects specific category, then it generates a power calculation.

From the category lists, the first three categories always make:

307 redirect warning page.

However, the remaining categories after fourth one does not make warning and gives straight calculated power.

This is my code to return calculated power from PracticePower class. Do you have any idea how to get rid of that warning message on first three categories? The other remaining categories use the same code as above.

I have tried to change some form action, but it did not work

@app.route ('/Practice1/', methods = ['GET','POST'])
def create22():
    print('request.method', request.method)
    if request.method == 'GET':
        content = '''
            <form action ="/Practice1" method = 'POST'>
                <p><h1>Practice 1 Calculation Page </h1></p>
                <p><label for = "LTE"> Choose BW of LTE: </label>
                <select name = "LTE" id = "LTE">
                    <option value = "0">0</option>
                    <option value = "5">5</option>
                    <option value = "10">10</option>
                    <option value = "15">15</option>
                    <option value = "20">20</option>
                </select>
                </p>
                <p><label for = "NR"> Choose BW of NR: </label>
                <select name = "NR" id = "NR">
                    <option value = "0">0</option>
                    <option value = "5">5</option>
                    <option value = "10">10</option>
                    <option value = "15">15</option>
                    <option value = "20">20</option>
                </select>
                </p>
                <p><input type = "submit" value = "Check"</p>
            </form>
        '''
        return content
    elif request.method == 'POST':
        LTE = int(request.form['LTE'])
        NR = int(request.form['NR'])
        return PracticePower.Practice_calculation(LTE,NR)

Related Questions