Flask Request Object in template


22/03/2019, 18:26

Here is some useful information about Flask Request Object methods you can use inside your templates:

request.method
GET
request.url
http://127.0.0.1:5000/test/some-part/another?x=2&test=something
request.base_url
http://127.0.0.1:5000/test/some-part/another
request.url_charset
utf-8
request.url_root
http://127.0.0.1:5000/
request.host_url
http://127.0.0.1:5000/
request.host
127.0.0.1:5000
request.path
/test/some-part/another
request.full_path
/test/some-part/another?x=2&test=something
request.args
ImmutableMultiDict([('x', '2'), ('test', 'something')])
Get specific argument
request.args.get('x')
request.args.get('test')
2
something


Комментарии