GNOME Bugzilla – Bug 612568
Error while creating a user account
Last modified: 2010-03-19 18:27:59 UTC
* Operating System: Gentoo Stable * Snowy version: checkout on 11/03/2010 * Backend used: tested with both mysql / sqlite * General Error: error at /accounts/register/ (111, 'Connection refused') Request Method: POST Request URL: http://127.0.0.1:8000/accounts/register/ Exception Type: error Exception Value: (111, 'Connection refused') Exception Location: /usr/lib/python2.6/socket.py in create_connection, line 514 Python Executable: /usr/bin/python2.6 Python Version: 2.6.4 Python Path: ['/home/stefano/Desktop/snowy', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/PIL', '/usr/lib/python2.6/site-packages/gst-0.10', '/usr/lib/python2.6/site-packages/gtk-2.0', '/usr/lib/portage/pym', '/home/stefano/Desktop/snowy/lib', '/home/stefano/Desktop/snowy/lib'] Server time: Thu, 11 Mar 2010 09:19:36 -0500 * Stacktrace: Environment: Request Method: POST Request URL: http://127.0.0.1:8000/accounts/register/ Django Version: 1.1.1 Python Version: 2.6.4 Installed Applications: ['core', 'api', 'accounts', 'notes', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.humanize', 'registration', 'south', 'reversion', 'gravatar', 'autoslug', 'piston', 'pagination'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.csrf.middleware.CsrfViewMiddleware', 'django.contrib.csrf.middleware.CsrfResponseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.transaction.TransactionMiddleware', 'reversion.middleware.RevisionMiddleware', 'recaptcha_django.middleware.ReCaptchaMiddleware', 'pagination.middleware.PaginationMiddleware') Traceback:
+ Trace 220920
response = callback(request, *callback_args, **callback_kwargs)
new_user = form.save()
email=self.cleaned_data['email'])
res = func(*args, **kw)
send_mail(subject, message, settings.DEFAULT_FROM_EMAIL, [new_user.email])
connection=connection).send()
return self.get_connection(fail_silently).send_messages([self])
new_conn_created = self.open()
local_hostname=DNS_NAME.get_fqdn())
(code, msg) = self.connect(host, port)
self.sock = self._get_socket(host, port, self.timeout)
return socket.create_connection((port, host), timeout)
raise error, msg
Exception Value: (111, 'Connection refused')
On openSUSE 11.2, I get a different trace, but I'm sharing in case it is related/helpful: Environment: Request Method: POST Request URL: http://localhost:8000/accounts/register/ Django Version: 1.1 Python Version: 2.6.2 Installed Applications: ['core', 'api', 'accounts', 'notes', 'django.contrib.admin', 'django.contrib.admindocs', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.humanize', 'registration', 'south', 'reversion', 'gravatar', 'autoslug', 'piston', 'pagination'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.csrf.middleware.CsrfViewMiddleware', 'django.contrib.csrf.middleware.CsrfResponseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'snowy.accounts.middleware.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.transaction.TransactionMiddleware', 'reversion.middleware.RevisionMiddleware', 'recaptcha_django.middleware.ReCaptchaMiddleware', 'pagination.middleware.PaginationMiddleware') Traceback:
+ Trace 220921
Exception Value: No module named signals
I can reproduce Stefano's problem. It is caused by Django's send_mail(), which assumes that the SMTP server specified in snowy.settings is available (localhost:25 by default). On most systems, it isn't. The Django developers seem to solve this by running a temporary debugging server, that outputs sent emails to stdout. They do not seem to be adding an option for not sending email at all. http://code.djangoproject.com/ticket/8638 I'm adding a patch that adds a mail debugging server of this kind to Snowy. It fixes the problem, and makes it easier to debug emails and open account activation links. Sandy's problem seems unrelated to me, but maybe the patch magically fixes that too. :-)
Created attachment 155885 [details] [review] Add a simple mail debugging server Django's send_mail() assumes that the SMTP server as set in snowy.settings is available, and gives an error otherwise. This patch adds a debugmail command to manage.py, which starts a small smptd server that matches these settings. Instead of sending emails, they are printed to stdout.
Review of attachment 155885 [details] [review]: Looks good to me. I made one comment to update your NOTE in INSTALL, but otherwise I'm happy with it. Thanks for this! ::: INSTALL @@ +30,3 @@ + + python manage.py debugmail +4. Start mail debugging server (in your snowy git checkout): maybe say "NOTE: This is only needed if Snowy needs to send mails (like in the case of user registration) and you don't have an SMTP server set up."
Thanks, committed the patch with the note change.