>>> from urllib.parse import urljoin >>> urljoin('/media/path/', 'js/foo.js') '/media/path/js/foo.js'