Am having errors thrown in my flask application for the below Code.
@@app.route('/')
.....
return redirect(url_for('nextPage'),id=DBTable.id)
@app.route('/<path:id>')
@login_required
def nextPage(id):
return render_template('page2.html')
Error -
---------------------------------------------------------------------------
File "C:\Python27\lib\site-packages\werkzeug\routing.py", line 1607, in build
raise BuildError(endpoint, values, method)
BuildError: ('nextPage', {}, None)
<SocketIOServer fileno=116 address=0.0.0.0:5000>: Failed to handle request:
request = POST /landingPage HTTP/1.1 from ('127.0.0.1', 50287)
application = <flask.app.Flask object at 0x0000000002643B70>
Kindly help me with the above issue
Besides all the obvious syntax errors, the problem should be resolved by placing the arguments that you pass to the route within the url_for
block.
@app.route('/')
def index():
# ...
return redirect(url_for('nextPage', id=DBTable.id))
@app.route('/<id>')
def nextPage(id):
# ...
return render_template('page2.html')