Django Email Timeout on Production Server - django

I recently deployed a site that I developed in Django onto a production server running Ubuntu 19.10 and Apache/2.4.41. I've been able to get my site functioning in every respect with the exception of sending emails using SMTP. When running my site on the development server on my local machine Django is able to send emails without issue, but on the production server any attempt by the site to send an email hangs and eventually results in a server error. In Apache's error.log I'm finding this at the bottom of the traceback: TimeoutError: [Errno 110] Connection timed out. Curiously, this problem persists if I turn on port 8000 and run this site with Django's development server from the remote machine.
I've made sure that my settings.py is configured properly (as I mentioned this works fine on my local computer).
settings.py
...
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = site_config.get('EMAIL_USER')
EMAIL_HOST_PASSWORD = site_config.get('EMAIL_PASS')
My suspicion has been that the issue must be related to my firewall blocking outgoing traffic on port 587, but I double checked my settings and couldn't see how this could be the case. I even manually set rules to allow outgoing traffic on port 587 and 25 to be sure, but did not have any success.
ufw status
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip
To Action From
-- ------ ----
22/tcp ALLOW IN Anywhere
80/tcp ALLOW IN Anywhere
22/tcp (v6) ALLOW IN Anywhere (v6)
80/tcp (v6) ALLOW IN Anywhere (v6)
587 ALLOW OUT Anywhere
25/tcp ALLOW OUT Anywhere
587 (v6) ALLOW OUT Anywhere (v6)
25/tcp (v6) ALLOW OUT Anywhere (v6)
I've tried testing that I'm able to establish SMTP connections at all using the advice offered in this post and got a timeout error there as well.
All of this seems to point to some sort of error in the way I've configured my firewall and/or Apache, but, after reading a number of posts on SO and elsewhere, I feel I've run out of ideas.
Lastly, here's what I'm seeing in the error log:
/var/log/apache2/error.log
log: ERROR - Internal Server>
Traceback (most recent call last):
File "/home/user/mysite/venv>
response = get_response(request)
File "/home/user/mysite/venv>
response = self.process_exception_by_middleware(e,>
File "/home/user/mysite/venv>
response = wrapped_callback(request, *callback_arg>
File "/home/user/mysite/venv>
return self.dispatch(request, *args, **kwargs)
File "/home/user/mysite/venv>
return bound_method(*args, **kwargs)
File "/home/user/mysite/venv>
response = view_func(request, *args, **kwargs)
File "/home/user/mysite/venv>
return super().dispatch(*args, **kwargs)
File "/home/user/mysite/venv>
return handler(request, *args, **kwargs)
File "/home/user/mysite/venv>
return self.form_valid(form)
File "/home/user/mysite/venv>
form.save(**opts)
File "/home/user/mysite/venv>
user_email, html_email_template_name=html_email_te>
File "/home/user/mysite/venv>
email_message.send()
File "/home/user/mysite/venv>
return self.get_connection(fail_silently).send_mes>
File "/home/user/mysite/venv>
new_conn_created = self.open()
File "/home/user/mysite/venv>
self.connection = self.connection_class(self.host,>
File "/usr/lib/python3.7/smtplib.py", line 251, in _>
(code, msg) = self.connect(host, port)
File "/usr/lib/python3.7/smtplib.py", line 336, in c>
self.sock = self._get_socket(host, port, self.time>
File "/usr/lib/python3.7/smtplib.py", line 307, in _>
self.source_address)
File "/usr/lib/python3.7/socket.py", line 727, in cr>
raise err
File "/usr/lib/python3.7/socket.py", line 716, in cr>
sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out
I'd happily add more information to this if there is anything important that I've left out. This is my first attempt at deploying a site to a remote server so keep in mind this is all a bit new to me.

If you use Linode to deploy your website, note that the port 587 is blocked by default.
It took me 2 days to figure it out.

Related

Django App deployed to EB Could not translate host name

I tried to send an email after an user object gets created. I use celery to perform the task. My application was deployed to AWS Elastic Beanstalk (Linux2 Python3.7). I have one RDS configured for my environment. Whenever I created a new user, my celery worker got the same error as follow:
This is the error I got in celery-worker.log
[2020-08-17 10:51:20,667: INFO/MainProcess] Received task: account.tasks.send_user_email_when_user_created_by_admin[0c202693-43b7-44b7-a9b9-0362bc38afac]
[2020-08-17 10:51:20,675: WARNING/ForkPoolWorker-1] Sending email for new usr
[2020-08-17 10:51:20,693: ERROR/ForkPoolWorker-1] Task account.tasks.send_user_email_when_user_created_by_admin[0c202693-43b7-44b7-a9b9-0362bc38afac] raised unexpected: OperationalError('could not translate host name "aa1rm1r9klym9tk.ce9nktrqundw.us-west-2.rds.amazonaws.com" to address: Name or service not known\n')
Traceback (most recent call last):
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect()
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params)
File "/var/app/venv/staging-LQM1lest/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 178, in get_new_connection
connection = Database.connect(**conn_params)
File "/var/app/venv/staging-LQM1lest/lib64/python3.7/site-packages/psycopg2/__init__.py", line 127, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not translate host name "aa1rm1r9klym9tk.ce9nktrqundw.us-west-2.rds.amazonaws.com" to address: Name or service not known
This is the code I used for sending an email to user
#receiver(post_save, sender=User)
def create_profile_handler(sender, instance, created, **kwargs):
if created:
profile = models.Profile(user=instance)
profile.save()
transaction.on_commit(tasks.send_user_email_when_user_created_by_admin.delay(instance.id))
I don't know where this host name came from as I couldn't find such rds under my account. I did the nslookup aa1rm1r9klym9tk.ce9nktrqundw.us-west-2.rds.amazonaws.com 8.8.8.8 and it couldn't find such domain. What caused this issue? How to fix it?
The database you're trying to reach doesn't exist under that hostname. There are no DNS records for that domain name: https://www.nslookup.io/dns-records/aa1rm1r9klym9tk.ce9nktrqundw.us-west-2.rds.amazonaws.com/cloudflare/. You probably misconfigured your database settings in Django.

ssl.SSLEOFError while sending emails through Django

Settings
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER = 'no_reply#domain.com'
SERVER_EMAIL = 'no_reply#domain.com'
DEFAULT_DO_NOT_REPLY = 'User <no_reply#domain.com>'
EMAIL_HOST_PASSWORD = 'xxxxxxxxx'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
Class
class EmailThread(threading.Thread):
def __init__(self, subject, context, recipient, template):
self.subject = subject
self.recipient = recipient
self.message = get_template(template).render(context)
threading.Thread.__init__(self)
def run(self):
msg = EmailMessage(
subject=self.subject,
from_email=settings.DEFAULT_DO_NOT_REPLY,
to=self.recipient,
body=self.message
)
msg.content_subtype = "html"
try:
msg.send(fail_silently=False)
log.info("E-mail triggered. Subject: '%s', to: %s" % (self.subject, self.recipient))
except Exception as e:
log.exception(e)
Usage
def notify_admin_blocked_account(user):
"""
Sends sends an email when the account is blocked
:return:
"""
email = EmailThread(
subject='{}, your account has been blocked'.format(user),
context={
'user': user,
'login_attempts': settings.MAX_STAFF_PWD_ATTEMPTS,
},
recipient=[user.email,],
template='mail/notify_admin_blocked_account.html'
)
email.start()
Error
[ERROR][2017-08-01 10:40:26,835][mail] EOF occurred in violation of protocol (_ssl.c:645)
Traceback (most recent call last):
File "./bin/mail.py", line 27, in run
msg.send(fail_silently=False)
File "/home/web/sites/envs/project/lib/python3.5/site-packages/django/core/mail/message.py", line 348, in send
return self.get_connection(fail_silently).send_messages([self])
File "/home/web/sites/envs/project/lib/python3.5/site-packages/django/core/mail/backends/smtp.py", line 104, in send_messages
new_conn_created = self.open()
File "/home/web/sites/envs/project/lib/python3.5/site-packages/django/core/mail/backends/smtp.py", line 69, in open
self.connection.starttls(keyfile=self.ssl_keyfile, certfile=self.ssl_certfile)
File "/usr/lib/python3.5/smtplib.py", line 766, in starttls
server_hostname=self._host)
File "/usr/lib/python3.5/ssl.py", line 377, in wrap_socket
_context=self)
File "/usr/lib/python3.5/ssl.py", line 752, in __init__
self.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:645)
I have some weird behavior when I try to send an e-mail (async) with Django. I really wanted to avoid third-party apps being installed to reduce code fragmentation - specially with some of them that seem to use crontab.
It is worth noticing that the error doesn't happen all the time. However, even though it doesn't happen, sometimes e-mails are not sent either. Only some of them manage to go through.
On my development environment it runs fine, and I can send the e-mails. However, on my production environment (EC2 instance) it simply doesn't work.
If I trigger an e-mail through the normal process, it is not sent. If I login to the server, open the manage.py shell, import a project and call the function that sends e-mail, sometimes I receive both triggered and manually-triggered e-mails or get an error (the one bellow).
My solution was to use Django-Mailer. It fragments the project, something I wanted to avoid, but its usage is pretty minimalist.

I have a GeocoderQueryError and suspect it's an issue with my API management

GeocoderQueryError at /search/
Your request was denied.
I'm seeing this issue across all versions of my application. That is locally, on staging, and on production. This leads me to believe it's something I've done in the API console since I haven't touched production and only touched the API call on staging. I have been in the API console but have only added IP addresses to "Accept requests from these server IP addresses" input in the credentials tab.
Here is the staging link: test.translgx.com
You'll only see a 500 page after searching for a ZIP code. I've included the full error report from my local installation at the bottom of the post, I hope this is helpful. If not, let me know and I'll do what I can to get the info needed to solve this.
Full disclosure, I'm a front-end guy and don't have the debugging/diagnostic skills needed to figure this out. I also don't have any back-end dev support available to me until next week. Google's support docs tell me to come here with questions so I'm hoping someone here shows mercy and points me in the right direction.
I should also note that the API key I see in production doesn't match any key in my console.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/search/?address=94133&distance=zip&truck=
Django Version: 1.9.4
Python Version: 2.7.11
Installed Applications:
('django_pdb',
u'django.contrib.auth',
u'django.contrib.contenttypes',
u'django.contrib.sessions',
u'django.contrib.sites',
u'django.contrib.messages',
u'django.contrib.staticfiles',
u'django.contrib.admin',
u'django.contrib.gis',
u'crispy_forms',
u'post_office',
u'widget_tweaks',
u'captcha',
u'geoposition',
u'cities_light',
u'templatetag_handlebars',
u'trucking_directory.common.apps.CommonConfig',
'debug_toolbar',
'django_extensions')
Installed Middleware:
(u'django.contrib.sessions.middleware.SessionMiddleware',
u'django.middleware.common.CommonMiddleware',
u'django.middleware.csrf.CsrfViewMiddleware',
u'django.contrib.auth.middleware.AuthenticationMiddleware',
u'django.contrib.messages.middleware.MessageMiddleware',
u'django.middleware.clickjacking.XFrameOptionsMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware',
'django_pdb.middleware.PdbMiddleware')
Traceback:
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 149.
response = self.process_exception_by_middleware(e, request)
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 147.
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/utils/decorators.py" in inner 184.
return func(*args, **kwargs)
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/views/generic/base.py" in view 68.
return self.dispatch(request, *args, **kwargs)
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/views/generic/base.py" in dispatch 88.
return handler(request, *args, **kwargs)
File "/Users/me/Sites/_app/trucking-directory/trucking_directory/common/views.py" in get 261.
self.form.is_valid()
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/forms/forms.py" in is_valid 161.
return self.is_bound and not self.errors
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/forms/forms.py" in errors 153.
self.full_clean()
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/forms/forms.py" in full_clean 362.
self._clean_fields()
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/django/forms/forms.py" in _clean_fields 383.
value = getattr(self, 'clean_%s' % name)()
File "/Users/me/Sites/_app/trucking-directory/trucking_directory/common/forms.py" in clean_address 218.
locations = _get_location(data, False)
File "/Users/me/Sites/_app/trucking-directory/trucking_directory/common/forms.py" in _get_location 38.
location = g.geocode(address, exactly_one=one)
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/geopy/geocoders/googlev3.py" in geocode 217.
self._call_geocoder(url, timeout=timeout), exactly_one
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/geopy/geocoders/googlev3.py" in _parse_json 338.
self._check_status(page.get('status'))
File "/Users/me/Envs/tlx-d/lib/python2.7/site-packages/geopy/geocoders/googlev3.py" in _check_status 369.
'Your request was denied.'
Exception Type: GeocoderQueryError at /search/
Exception Value: Your request was denied.
You probably need to add an API key. If you don't have one, try the GET A KEY in the top-left corner of the Geocoding API guide. The, I think this code should work (borrowed from here):
from geopy.geocoders import GoogleV3
point = '51.523910, -0.158578'
geocoder = GoogleV3(api_key=YOUR_API_KEY)
address = geolocator.reverse(point)

Django registration [Errno 10013] error

so for some reason this error([Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions), keeps occurring. when i try to use registration in Django. I am using windows 7 and pycharm IDE with django 1.65. I have already tried different ports to run server (8001 & 8008) and also adding permission in windows firewall and kasperesky firewall for python.exe and pycharm. Any suggestion.
Environment:
Request Method: POST
Request URL: http://127.0.0.1:8001/accounts/register/
Django Version: 1.6.5
Python Version: 2.7.8
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'profiles',
'south',
'registration',
'PIL',
'stripe')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\core\handlers\base.py" in get_response
112. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\views\generic\base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\views.py" in dispatch
79. return super(RegistrationView, self).dispatch(request, *args, **kwargs)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\views\generic\base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\views.py" in post
35. return self.form_valid(request, form)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\views.py" in form_valid
82. new_user = self.register(request, **form.cleaned_data)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\backends\default\views.py" in register
80. password, site)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\db\transaction.py" in inner
431. return func(*args, **kwargs)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\models.py" in create_inactive_user
91. registration_profile.send_activation_email(site)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\registration\models.py" in send_activation_email
270. self.user.email_user(subject, message, settings.DEFAULT_FROM_EMAIL)
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\contrib\auth\models.py" in email_user
413. send_mail(subject, message, from_email, [self.email])
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\core\mail\__init__.py" in send_mail
50. connection=connection).send()
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\core\mail\message.py" in send
274. return self.get_connection(fail_silently).send_messages([self])
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\core\mail\backends\smtp.py" in send_messages
87. new_conn_created = self.open()
File "C:\Users\jasan\Virtual_enviornments\virtual_env_matchmaker\lib\site-packages\django\core\mail\backends\smtp.py" in open
48. local_hostname=DNS_NAME.get_fqdn())
File "C:\Python27\Lib\smtplib.py" in __init__
251. (code, msg) = self.connect(host, port)
File "C:\Python27\Lib\smtplib.py" in connect
311. self.sock = self._get_socket(host, port, self.timeout)
File "C:\Python27\Lib\smtplib.py" in _get_socket
286. return socket.create_connection((host, port), timeout)
File "C:\Python27\Lib\socket.py" in create_connection
571. raise err
Exception Type: error at /accounts/register/
Exception Value: [Errno 10013] An attempt was made to access a socket in a way forbidden by its access permissions
The problem has to do with your email server setup. Instead of figuring out what to fix, just set your EMAIL_BACKEND in settings.py to the following:
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
This way, any email sent by django will be shown in the console instead of attempting delivery. You can then continue developing your application.
Having emails printed on the console is good if you are developing, but it can be a headache if your application is sending a lot of emails across.
A better solution is to install mailcatcher. This application will create a local mail server for testing and as a bonus, provide you a web interface where you can view the emails being sent by your server:
It is a Ruby application, and as you are on Windows, I would suggest using rubyinstaller to help with gem installation.
The website also shows you how to configure django:
if DEBUG:
EMAIL_HOST = '127.0.0.1'
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_PORT = 1025
EMAIL_USE_TLS = False
This has nothing to do with your webserver ports, this is to do with the host and port that smtplib is trying to open in order to send an email.
These are controlled by settings.EMAIL_HOST and settings.EMAIL_PORT. There are other settings too, see the documentation for details on how to set up email properly.

Permission denied error while trying to register and email to user on website using django 1.6 + django-allauth on CentOS 6.5 + httpd webserver

I am running Django 1.6 framework on CentOS 6.5 (AWS EC2 instance) and serving the website using httpd web server. I am using django-allauth package for user account signup. When one signs up, allauth sends an outbound email to the user and then the user has to confirm their email address by clicking on a link in the email. Here are the corresponding SMTP settings in settings.py:
# smtp server settings for gmail
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'myusername#gmail.com'
EMAIL_HOST_PASSWORD = '<mypassword>'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
On my development server (which is also a CentOS 6.5 on a Virtualbox on my Windows laptop), on which I just run the Django based webserver (using python manage.py runserver), all is well i.e. When I do a registration, it is able to send an outbound email and I am able to successfully register and login subsequently.
But on the test server (AWS EC2 instance running CentOS 6.5 using httpd and using Django 1.6 on it), when I try to register, it ends up in the page throwing a "Permission denied" error, the details of the stack trace which I am pasting below.
error at /accounts/signup/
[Errno 13] Permission denied
Request Method: POST
Request URL: http://<server_ip_address>/accounts/signup/
Django Version: 1.6.2
Exception Type: error
Exception Value:
[Errno 13] Permission denied
Exception Location: /usr/lib64/python2.6/socket.py in create_connection, line 567
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/var/www/html/firstProject',
'/usr/lib64/python26.zip',
'/usr/lib64/python2.6',
'/usr/lib64/python2.6/plat-linux2',
'/usr/lib64/python2.6/lib-tk',
'/usr/lib64/python2.6/lib-old',
'/usr/lib64/python2.6/lib-dynload',
'/usr/lib64/python2.6/site-packages',
'/usr/lib/python2.6/site-packages']
Request Method: POST
Request URL: http://<server_ip_address>/accounts/signup/
Django Version: 1.6.2
Python Version: 2.6.6
Installed Applications:
('django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'print_string',
'CompanyApp',
'UserApp',
'south',
'allauth',
'allauth.account',
'allauth.socialaccount',
'sendgrid',
'django_cleanup')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware')
Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
114. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.6/site-packages/django/views/generic/base.py" in view
69. return self.dispatch(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/allauth/account/views.py" in dispatch
62. **kwargs)
File "/usr/lib/python2.6/site-packages/allauth/account/views.py" in dispatch
133. **kwargs)
File "/usr/lib/python2.6/site-packages/django/views/generic/base.py" in dispatch
87. return handler(request, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/allauth/account/views.py" in post
78. response = self.form_valid(form)
File "/usr/lib/python2.6/site-packages/allauth/account/views.py" in form_valid
164. self.get_success_url())
File "/usr/lib/python2.6/site-packages/allauth/account/utils.py" in complete_signup
149. signal_kwargs=signal_kwargs)
File "/usr/lib/python2.6/site-packages/allauth/account/utils.py" in perform_login
117. send_email_confirmation(request, user, signup=signup)
File "/usr/lib/python2.6/site-packages/allauth/account/utils.py" in send_email_confirmation
278. signup=signup)
File "/usr/lib/python2.6/site-packages/allauth/account/models.py" in send_confirmation
56. confirmation.send(request, signup=signup)
File "/usr/lib/python2.6/site-packages/allauth/account/models.py" in send
131. ctx)
File "/usr/lib/python2.6/site-packages/allauth/account/adapter.py" in send_mail
93. msg.send()
File "/usr/lib/python2.6/site-packages/django/core/mail/message.py" in send
274. return self.get_connection(fail_silently).send_messages([self])
File "/usr/lib/python2.6/site-packages/django/core/mail/backends/smtp.py" in send_messages
87. new_conn_created = self.open()
File "/usr/lib/python2.6/site-packages/django/core/mail/backends/smtp.py" in open
48. local_hostname=DNS_NAME.get_fqdn())
File "/usr/lib64/python2.6/smtplib.py" in __init__
239. (code, msg) = self.connect(host, port)
File "/usr/lib64/python2.6/smtplib.py" in connect
295. self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib64/python2.6/smtplib.py" in _get_socket
273. return socket.create_connection((port, host), timeout)
File "/usr/lib64/python2.6/socket.py" in create_connection
567. raise error, msg
Exception Type: error at /accounts/signup/
Exception Value: [Errno 13] Permission denied
I am splitting my hair on why on my dev environment (Django on CentOS 6.5 running Django test web server + django-allauth) it works fine, whereas on the AWS EC2 instance running CentOS 6.5 + Django 1.6 + httpd + django-allauth, it ends up in this error. Has the root cause of this error do with the server's inability to send outbound emails? Or is it something else that is the root cause?
Any insights on how to resolve this issue and keep moving forward? I am open for change (including the OS if needed). But any resolution that would need the least changes would be helpful.
Thanks.