is it possible to have two app.route-functions?

Viewed 24

in my app.py I have a function create() for a formular, in which I can put a string, which then should be displayed. When I run the code, I get a Bad Request every time I want to submit something new. Why is that so? my code:

@app.route('/', methods=('GET', 'POST'))
def index():
if request.method == 'POST':
    zertifizierung = request.form['zertifizierung']

    if not zertifizierung:
        flash('Zertifizierung eingeben!')
    else:
        conn = get_db_connection()
        conn.execute('INSERT INTO cloudzertifizierungen (zertifizierung) VALUES (?)',
                     (zertifizierung))
        conn.commit()
        conn.close()
conn = get_db_connection()
cloudzertifizierungen = conn.execute('SELECT * FROM cloudzertifizierungen').fetchall()
conn.close()
return render_template('index.html', cloudzertifizierungen=cloudzertifizierungen)
0 Answers
Related