我正在尝试安装一个模块,以便让我的应用程序发送电子邮件,所以我在我的应用程序中安装了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(),
},
)