2013-10-29 29 views
0

在我的django應用程序中我正在使用django註冊應用程序。我在幾個月前正在測試註冊,它工作正常。從那時起,我沒有在django註冊過編輯任何東西,但不知何故,它不再工作。那麼註冊郵件不包含適當的鏈接:django-registration在哪裏設置域和協議變量?

Someone, hopefully you, signed up for a new account at domain.com using this email address. If it was you, and you'd like to activate and use your account, click the link below or copy and paste it into your web browser's address bar: 

:///accounts/activate/3789be99f7426ab3e332d252900479b59a400d45/ 

If you didn't request this, you don't need to do anything; you won't receive any more email from us, and the account will expire automatically in seven days. 

這是我activation_email.txt

{% load humanize %} 
Someone, hopefully you, signed up for a new account at domain.com using this email address. If it was you, and you'd like to activate and use your account, click the link below or copy and paste it into your web browser's address bar: 

{{ protocol }}://{{ domain }}/accounts/activate/{{ activation_key }}/ 

If you didn't request this, you don't need to do anything; you won't receive any more email from us, and the account will expire automatically in {{ expiration_days|apnumber }} days. 

所以協議和域變量不通過。我應該在哪裏設置它們?

回答

2

我認爲django-registration從django-site表中獲取有關域的信息 - 您應該檢查該表中的域字段或通過管理頁面對其進行編輯。

你可以閱讀網站的框架在這​​裏: https://docs.djangoproject.com/en/dev/ref/contrib/sites/

+0

我有我的域名 - > 「domain.com」 在django_site表中設置。但我已經通過sql update語句將example.com更改爲db中的「domain.com」。我在我的設置中有「SITE_ID = 1」,並且在django_site中的ID也是1.我正在使用south遷移。 – Lucas03

+0

您使用的模板看起來有點類似於密碼重置模板,但是activation_email模板沒有使用您使用的值。我只是有類似的問題,並注意到沒有可用的協議(或類似的)變量,所以它只能在模板中使用硬編碼的http或https。只是谷歌的Django註冊的一些默認模板,看到一個工作模板(雖然不靈活的http/https工作)。 –