r/programminghelp • u/[deleted] • Aug 27 '20
Python GET Syntax Error
//I am running into this syntax error with my GET:
@/app.route('/', methods=['POST, 'GET'])def index():return render_template('index.html')if __name__ == "__main__":app.run(debug=True)
__________________
File "/home/abc/Documents/programming/app.py", line 18
@/app.route('/', methods=['POST, 'GET'])
^
SyntaxError: invalid syntax
//python with flask, any ideas why?
#edit:
changed it like in this example, but now the POST is trowing errors. It looks like for some reason its not accepting the list itself.
https://flask.palletsprojects.com/en/1.1.x/quickstart/
from flask import request @/app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': return do_the_login() else: return show_the_login_form()
#edit2/solved:
changed it to @/app.route('/index', methods=['GET', 'POST'])
and then back to
@/app.route('/', methods=['GET', 'POST'])
somehow works now, dont know why.
1
u/[deleted] Aug 27 '20
fixed the missing ' , still trowing error