Django: Get base URL for sending links in email

1.6k views Asked by At

I have a django app myapp, which registers a menu-command foo to be called via ./manage.py foo.

The command should send a reminder email to all users. The mail contains a link in it, to a specific view, lets say bar. bar has the this entry in the urls.py:

url(r'^(?P<id>\d+)/$', views.bar, name='bar'),

How do I correctly determine the absolute url in this context?

The relative url would be reverse('myapp:bar'). But how do I get the base to that?

I could just hardcode it in settings.py of my project, but that would go against the philosophy of django, wouldn't it?

0

There are 0 answers