Reputation: 20886
Im trying to access request object in my html but unble to access it..How can I pass the request object to my HTML
<html>
<head>
</head>
<body>
<form action="/start" method="post">
<span>Username:</span>
<input type="text" name="username">
<span>Password:</span>
{{ request.url }}
<input type="password" name="password">
<input type="submit" value="Sign in">
</form>
</body>
</html>
test.py
from bottle import route, run, template, redirect
@route('/hello')
def hello():
return template('login')
run(host='localhost', port=8082, debug=True)
Upvotes: 0
Views: 1012
Reputation: 18148
You should be able to just pass request
into the template like this:
from bottle import route, run, template, redirect
import bottle
@route('/hello')
def hello():
return template('login', request=bottle.request)
Upvotes: 2