1

我正在学习如何在 Django 中开发,所以我还有很多东西需要学习,所以,如果我有任何概念错误,请通知我。

我的问题是我正在尝试安装 django-templated-email 包,以便我可以使用 mailchimp 从我的应用程序发送电子邮件,我下载了https://github.com/bradwhittington/django-templated-email并按照说明操作(使用项目根文件夹中的 pip 指令),但是,当我添加时:

from templated_email.backends.vanilla_django import TemplateBackend
TEMPLATED_EMAIL_BACKEND = TemplateBackend

在我的 settings.py 中,尝试运行本地服务器时出现此错误:

ImportError: Could not import settings 'proyect.settings' (Is it on sys.path?): No module named templated_email.backends.vanilla_django

我已经读过它开箱即用,所以我可以删除这些行并仍然让包工作(或者至少这是我所理解的)。我真正的问题是在我的views.py中添加这个,所以我可以使用这个包:

from templated_email import send_templated_mail

我总是得到这个错误:

ImportError at /awards/get/reward/
No module named templated_email
Request Method: POST
Request URL:    http://127.0.0.1:8000/awards/get/reward/
Django Version: 1.4
Exception Type: ImportError
Exception Value:    
No module named templated_email
Exception Location: /Users/xxxxx/xxxx/proyect/proyect/quizzer/views.py in awards_get, line 1316
Python Executable:  /usr/bin/python
Python Version: 2.7.1
Python Path:    
['/Users/xxxxx/xxxx/proyect/proyect',
 '/Library/Python/2.7/site-packages/pip-1.0-py2.7.egg',
'/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']
Server time:    sáb, 12 Ene 2013 10:48:28 +0100

它在我添加导入行的第 1316 行

希望你能帮我解决我的问题,这样我就可以开始发送电子邮件和时事通讯了!

4

1 回答 1

1

/Users/xxxxx/xxxx/proyect/proyect在 python 路径中添加但未添加/Users/xxxxx/xxxx/proyect

于 2013-01-12T11:52:52.883 回答