Django: get the current domain(http_host) from signals
I am sending a mail with different confirmation links from different signals. These mails contain a link that the recipient has to click. If I am sending the link from www.example.com the confirmation link looks something like www.example.com/confirmation.
At the moment I am hard coding the开发者_如何学Go domain name inside my settings file but maybe there is a better way more flexible way?
Use standard sites contrib app
if you don't want to use the site framework just to get domain name you can use the get_host function with request object. domain_name = request.get_host() but remember that this function return also the port use when requesting the page, So you can have domain.com:8000 for example
精彩评论