google app engine - 403 Forbidden POST - Flask WTForms -
i have flask application running on google app engine. trying submit form built using wtform , keep getting following error.
403 forbidden: don't have permission access requested resource. either read-protected or not readable server.
location.html (part of code)
<form method=post action="/home/location"> .... <button type="submit" class="btn btn-primary" value="submit"> directions </button> </form>
main.py
@app.route('/home/location', methods=['post', 'get']) def location(): form = cfcdirections.direction(request.form) print(request.method) if request.method == 'post' , form.validate(): print("after if") directions = cfcdirections() street_no = directions.no street = directions.street suburb = directions.suburb postcode = directions.postcode state = directions.state return render_template('location.html',form=form)
don't forget include csrf token in form:
<form method=post action="/home/location"> {{ form.csrf_token }} .... <button type="submit" class="btn btn-primary" value="submit"> directions </button> </form>
Comments
Post a Comment