发表文章

[Python] 激活电子邮件不工作 activation email not work[django-registration]

peterwu2006 2017-10-9 46

嗨哥们

我在安装新版本1.8 时遇到问题。注册后, 用户的激活电子邮件无法送行, 同时登录管理视图后, 我可以发送电子邮件手动与 ' 重新发送激活电子邮件 ' 按钮。有人能帮我吗?多谢了当我切换到 "admin_approval" 模式, 在用户注册后的电子邮件到管理员的权利也找不到。

原文:

Hi buddies,

I have a problem when I installed a new fresh version 1.8. The activation email to user after registration could NOT be sendoff, meanwhile after login admin view I could send email manually with 'resend activation email' button. anyone could help me? many thanks. When I switch to 'admin_approval' mode, the email to admin right after user registration could NOT be found as well.

相关推荐
最新评论 (12)
peterwu2006 2017-10-9
1

在这里附上我的配置,

在 url 中。
url(r'^accounts/', include('registration.backends.admin_approval.urls')),

在 "设置." (电子邮件设置不显示, 但我相信这是正确的, 因为我可以通过其他应用程序发送电子邮件)

原文:

attached my configuration here,

in url.py
url(r'^accounts/', include('registration.backends.admin_approval.urls')),

in settings.py (email settings are NOT presented, but I am sure that's correct, because I could sent out email via other apps)

joshblum 2017-10-9
2

@peterwu2006为了完整性, 您可以提供电子邮件设置吗?管理审批界面是否在早期版本的 django 注册中起作用?

原文:

@peterwu2006 for completeness can you provide the email settings? Did the admin approval interface work on an earlier version of django-registration?

peterwu2006 2017-10-9
3

@joshblum
我找到了线索, 我下面的设置是不正确的。谢谢你的提醒。
SEND_ACTIVATION_EMAIL = False

当我把它改成真, 现在一切都好了。

原文:

@joshblum
I found the clue, my setting below is not correct. Thanks for your reminder.
SEND_ACTIVATION_EMAIL = False

when I change it to True, everything is OK now.

peterwu2006 2017-10-9
4

@joshblum
对不起我又打扰你了

我发现当我切换回 admin_approval 模式时,

电子邮件激活电子邮件仍将发送给用户, 但没有电子邮件发送到管理员批准。

原文:

@joshblum
Sorry my bother you again,

I found when I switch back to admin_approval mode,

the email activation email will still send to the user, but no email sending to admin for the approval.

joshblum 2017-10-9
5

@peterwu2006没有问题!你能看看这个函数

配置文件= SupervisedRegistrationProfile.objects.get (id=profile_id)
并尝试调试代码路径以检查是否发送了电子邮件?是否可能已尝试批准已将 is_active 标志设置为 True 的用户, 以便不发送邮件? 原文:

@peterwu2006 no problem! can you take a look at the function

profile = SupervisedRegistrationProfile.objects.get(id=profile_id)
and try debugging the code path to check if the email is sent? Is it possible you tried approving a user that already had the is_active flag set to True so no mail was sent?
peterwu2006 2017-10-9
6

@joshblum

我试图调试, 似乎整个过程都没有机会通过你上面提到的453行。

try: import pdb; pdb.set_trace() profile = SupervisedRegistrationProfile.objects.get(id=profile_id) if profile.activated: if profile.user.is_active: return profile.user

但这一过程确实经历了类 SupervisedRegistrationManager, 因为一旦我添加了 "导入 pdb";pdb. set_trace () "如下所示, 控制台可以捕获它。

"类 SupervisedRegistrationManager (RegistrationManager):

import pdb; pdb.set_trace()

def _activate(self, profile, site, get_profile):`
原文:

@joshblum

I tried to debug, it seems the entire process have no chance to pass through the row 453 you mentioned above.

try: import pdb; pdb.set_trace() profile = SupervisedRegistrationProfile.objects.get(id=profile_id) if profile.activated: if profile.user.is_active: return profile.user

but the process truly went through class SupervisedRegistrationManager, because once I add ' import pdb; pdb.set_trace()' as below, the console could capture it.

`class SupervisedRegistrationManager(RegistrationManager):

import pdb; pdb.set_trace()

def _activate(self, profile, site, get_profile):`
joshblum 2017-10-9
7

@peterwu2006可以调试代码的哪个部分中断了吗?一旦你点击管理电子邮件, 似乎粗糙的代码路径是:

def获取(self请求*参数、 **kwargs):

def批准(self, *参数, **kwargs):

SupervisedRegistrationProfile.objects.admin_approve_user (

请看该请求通过这一关有多远, 它应该显示为什么批准不会通过。

原文:

@peterwu2006 can you debug which part of the code breaks down? Once you click the admin email, it seems that the rough code path is:

def get(self, request, *args, **kwargs):

to

def approve(self, *args, **kwargs):

to

SupervisedRegistrationProfile.objects.admin_approve_user(

See how far the request makes it through this pass it should show why the approval isn't going through.

peterwu2006 2017-10-9
8

@joshblum

通过调试跟踪, 但似乎所有调试点都不能通过。我发现的结果是, 一旦我注册新用户, 第一站是

12行在 django-注册/注册/后/admin_approval/视图。
'class RegistrationView(BaseRegistrationView): '
`

原文:

@joshblum

Traced with debug, but it seems all debug points are not be passed through. I found the result is once I register new user , the first stop is

row 12 in django-registration/registration/backends/admin_approval/views.py
with 'class RegistrationView(BaseRegistrationView): '
`

joshblum 2017-10-9
9

我很确定在类实例化过程中, 调试器将在该行停止, 但它实际上不会帮助我们进行调试。您是否有其他信息, 如请求日志可以帮助调试过程?

原文:

I'm pretty sure that the debugger will stop at that line during the class instantiation, but it won't actually help us debug. Do you have any other info like the request logs that can help the debug process?

peterwu2006 2017-10-9
10

@joshblum
除设置 url 之外, 其他任何配置都需要计算出来吗?
url(r'^accounts/', include('registration.backends.admin_approval.urls')),

似乎注册过程不能进入任何功能在 Supervisedxxxxx 类视图或配置文件, 很多感谢。

原文:

@joshblum
Besides setup url.py as below, any other config need to be figure out?
url(r'^accounts/', include('registration.backends.admin_approval.urls')),

it seems the register process could NOT go into any function in Supervisedxxxxx class view or profile, many thanks.

ioparaskev 2017-10-9
11

@peterwu2006
是否已正确设置了设置的 ADMINS 设置。
您是否可以在下面的行中的 send_admin_approve_email 中添加调试器以查看它是否通过以及使用什么值?

ifregistration_admins:
原文:

@peterwu2006
Have you properly set the ADMINS setting on your settings.py ?
Can you add a debugger at the send_admin_approve_email in the following line to see if it passes and with what values?

if not registration_admins:
peterwu2006 2017-10-9
12

@ioparaskev
我想结束这个案子, 因为我找到了另一种方法。多谢。

原文:

@ioparaskev
I'd like to close this case as I find a alternative way. Thanks a lot.

返回
发表文章
peterwu2006
文章数
10
评论数
7
注册排名
60797