导入django-templated-mail时出错

时间:2013-05-14 10:31:09

标签: django email django-templates email-integration importerror

我正在尝试安装模块以便我可以让我的应用程序发送电子邮件,因此我安装在我的应用https://github.com/bradwhittington/django-templated-email中,但是,即使我已按照所有说明操作,我收到此错误消息:

ImportError at /
cannot import name send_templated_mail
Request Method: GET
Request URL:    http://127.0.0.1:8000/
Django Version: 1.4
Exception Type: ImportError
Exception Value:    
cannot import name send_templated_mail
Exception Location: /Users/user/Dropbox/proyect/my-app/quizzer/views.py in <module>, line 32
Python Executable:  /usr/bin/python
Python Version: 2.7.1
Python Path:    
['/Users/user/Dropbox/proyect/my-app/quizzer/',
 '/Library/Python/2.7/site-packages/pip-1.0-py2.7.egg',
 '/Users/user/Dropbox/proyect/my-app/quizzer/quizzer/src/greatape/src',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages',
 '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']

有什么想法吗?

修改

from templated_email import send_templated_mail
send_templated_mail(
        template_name='tempname',
        from_email='******@gmail.com',
        recipient_list=['****@gmail.com'],
        context={
            'username':u.username,
            'date':datetime.date.today(),
        },
)

0 个答案:

没有答案