New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
502 bad gateway #29
Comments
I realized what was causing this error. However it was very unclear. May be something can be done in such case to notify user what's wrong. |
I don't recall |
Yes, I'm sure it was correct. After I changed superuser's email in the database there were no promlems anymore. |
I'm closing this issue since post-office doesn't do any permission checking. |
Again I get this error on another project. Changing settings.ADMINS and DEFAULT_FROM_EMAIL won't help. And this is something with post-office. When I remove |
@russian-master what's the recipient's email address? |
I don't know exactly but I guess it is taken from settings.ADMINS. It's regular email address there. I've noticed that such errors appears when it should render 404 error. And I have SEND_BROKEN_LINK_EMAILS=True |
Mind sending me the contents of |
I checked https://docs.djangoproject.com/en/dev/ref/settings/#send-broken-link-emails and learned that recipient email is taken from settings.MANAGERS. |
Oh my bad, I didn't properly read the traceback. Did you properly set It defaults to |
I changed settings for test: ADMINS = ( result: 502 bad gateway and django.core.exceptions.ValidationError: {'from_email': [u'Enter a valid e-mail address.']} in the uwsgi log |
@russian-master can you test it again to make sure? I just tested it with |
I restarted the server to be sure. And still get this error. And not only for 404 but also for 500 error pages. When I remove EMAIL_BACKEND = 'post_office.EmailBackend' I get my usual custom 500 html page displayed. |
Can you send me the latest traceback? If you can modify the source code, we can try to see what email it was trying to validate. Change this line to:
|
it said: I even searched through my project files but didn't find 'root@localhost'. |
Actually, post-office does use Does it only throw this error when you run the test? |
I dived into the django source and found this code in django\core\mail__init__.py: mail = EmailMultiAlternatives('%s%s' % (settings.EMAIL_SUBJECT_PREFIX, subject), SERVER_EMAIL !!! Not DEFAULT_FROM_EMAIL I set it in my settings.py and the problem went away. But without post-office there were no problem to send emails - I guess django checks settings.SERVER_EMAIL and if it's not set it uses DEFAULT_FROM_EMAIL. |
Ah ok, I didn't know about Well, we have two options for default email address, About the fact that Django's email backend does not raise any errors when sending to I'm going to close this as a wont fix, thanks for bringing this up. |
Sometimes I get 502 error.
What I see in logs:
File "/usr/lib/python2.6/logging/init.py", line 679, in handle
self.emit(record)
File "/django/utils/log.py", line 113, in emit
mail.mail_admins(subject, message, fail_silently=True, html_message=html_message)
File "/django/core/mail/init.py", line 98, in mail_admins
mail.send(fail_silently=fail_silently)
File "/django/core/mail/message.py", line 255, in send
return self.get_connection(fail_silently).send_messages([self])
File "/post_office/backends.py", line 43, in send_messages
headers=headers, priority=PRIORITY.medium)
File "/django/db/models/manager.py", line 149, in create
return self.get_query_set().create(**kwargs)
File "/django/db/models/query.py", line 416, in create
obj.save(force_insert=True, using=self.db)
File "/post_office/models.py", line 119, in save
self.full_clean()
File "/django/db/models/base.py", line 926, in full_clean
raise ValidationError(errors)
django.core.exceptions.ValidationError: {'from_email': [u'Enter a valid e-mail address.']}
I have regular settings.DEFAULT_FROM_EMAIL
and EMAIL_BACKEND = 'post_office.EmailBackend'
django 1.5
The text was updated successfully, but these errors were encountered: