- Author:
- limodou
- Posted:
- February 27, 2007
- Language:
- Python
- Version:
- Pre .96
- Score:
- 4 (after 6 ratings)
The result maybe:
http://localhost/test/
And for request.path, it will not include the domain field(http://localhost).
1 2 3 | def get_full_path(request):
full_path = ('http', ('', 's')[request.is_secure()], '://', request.META['HTTP_HOST'], request.path)
return ''.join(full_path)
|
More like this
- Template tag - list punctuation for a list of items by shapiromatron 9 months ago
- JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 9 months, 1 week ago
- Serializer factory with Django Rest Framework by julio 1 year, 3 months ago
- Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 4 months ago
- Help text hyperlinks by sa2812 1 year, 5 months ago
Comments
To be a bit more redundant, you could make that:
...or better:
#
Thanks. I lost secure.
#
You can use built-in function build_absolute_url()
#
Please login first before commenting.