我正在学习如何在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行,我添加了导入行
希望您能帮我解决问题,以便开始发送电子邮件和简报!
答案 0 :(得分:1)
您在python路径中添加了/Users/xxxxx/xxxx/proyect/proyect
但未添加/Users/xxxxx/xxxx/proyect