Tornado's reverse_url to a fully qualified URL
<p>Tornado's <code>reverse_url</code> is not a fully qualified URL. Is there a mechanism in Tornado to get back a fully qualified URL? For instance:</p>

<pre><code>&gt;&gt;&gt; some_method('foo', 1234)
http://localhost:8080/foo/1234
</code></pre>

<p>This is a small helper method which I add to all my handlers:</p>

<pre><code>from urllib.parse import urljoin  # urlparse in Python 2

class BaseHandler(tornado.web.RequestHandler):

    def reverse_full_url(self, name, *args, **kwargs):
        host_url = "{protocol}://{host}".format(**vars(self.request))
        return urljoin(host_url, self.reverse_url(name, *args, *kwargs))
</code></pre>

python tornado