Skip to content

Instantly share code, notes, and snippets.

@whilefalse
Created August 21, 2009 15:34
Show Gist options
  • Save whilefalse/172111 to your computer and use it in GitHub Desktop.
Save whilefalse/172111 to your computer and use it in GitHub Desktop.
def current_host(request):
url = 'http://%s' % request.META['SERVER_NAME']
if request.META['SERVER_PORT'] != 80:
url = url + ':%s' % request.META['SERVER_PORT']
return url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment