来自结账表格的夹层smtp

时间:2015-11-11 04:07:25

标签: django smtp mezzanine

我正在运行django / mezzanine服务器,并且表单提交(到目前为止工作正常)现在返回"错误/ shop / checkout / getaddrinfo()参数2必须是整数或字符串" 我究竟做错了什么?这是日志:

Request Method: POST
Request URL: http://www.styleandharmony.co.nz/shop/checkout/

Django Version: 1.8.5
Python Version: 2.7.9
Installed Applications:
(u'mezzanine.boot',
 u'styleandharmony',
 u'django.contrib.auth',
 u'django.contrib.contenttypes',
 u'django.contrib.redirects',
 u'django.contrib.sessions',
 u'django.contrib.sites',
 u'django.contrib.sitemaps',
 u'mezzanine.conf',
 u'mezzanine.core',
 u'mezzanine.generic',
 u'mezzanine.pages',
 u'cartridge_stripe',
 u'zebra',
 u'cartridge.shop',
 u'mezzanine.forms',
 u'mezzanine.galleries',
 u'mezzanine.accounts',
 u'compressor',
 u'filebrowser_safe',
 u'grappelli_safe',
 u'django.contrib.admin',
 u'django.contrib.staticfiles',
 u'django_comments')
Installed Middleware:
(u'mezzanine.core.middleware.UpdateCacheMiddleware',
 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.auth.middleware.SessionAuthenticationMiddleware',
 u'django.contrib.messages.middleware.MessageMiddleware',
 u'django.middleware.clickjacking.XFrameOptionsMiddleware',
 u'cartridge.shop.middleware.ShopMiddleware',
 u'mezzanine.core.request.CurrentRequestMiddleware',
 u'mezzanine.core.middleware.RedirectFallbackMiddleware',
 u'mezzanine.core.middleware.TemplateForDeviceMiddleware',
 u'mezzanine.core.middleware.TemplateForHostMiddleware',
 u'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
 u'mezzanine.core.middleware.SitePermissionMiddleware',
 u'mezzanine.pages.middleware.PageMiddleware',
 u'mezzanine.core.middleware.FetchFromCacheMiddleware')


Traceback:
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  125.                     response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/mezzanine/pages/middleware.py" in process_view
  99.                 return view_func(request, *view_args, **view_kwargs)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/cartridge/shop/views.py" in checkout_steps
  298.                     checkout.send_order_email(request, order)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/cartridge/shop/checkout.py" in send_order_email
  184.                        addr_bcc=settings.SHOP_ORDER_EMAIL_BCC or None)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/mezzanine/utils/email.py" in send_mail_template
  66.     msg.send(fail_silently=fail_silently)
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/django/core/mail/message.py" in send
  303.         return self.get_connection(fail_silently).send_messages([self])
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in send_messages
  100.             new_conn_created = self.open()
File "/home/benj/virtualenv_home/styleandharmony/local/lib/python2.7/site-packages/django/core/mail/backends/smtp.py" in open
  58.             self.connection = connection_class(self.host, self.port, **connection_params)
File "/usr/lib/python2.7/smtplib.py" in __init__
  256.             (code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py" in connect
  316.         self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py" in _get_socket
  291.         return socket.create_connection((host, port), timeout)
File "/usr/lib/python2.7/socket.py" in create_connection
  553.     for res in getaddrinfo(host, port, 0, SOCK_STREAM):

Exception Type: error at /shop/checkout/
Exception Value: getaddrinfo() argument 2 must be integer or string

1 个答案:

答案 0 :(得分:0)

如果其他人有这个问题,那只是因为字符串无法识别。 使用u'port转换为unicode进行修复。