问题描述
我正在学习如何在Django开发,所以有很多事情我还是要学,所以,如果我有任何的概念错误,请通知我。
I'm learning how to develop in Django, so there are a lot of things I've still have to learn, so, if I have any concept error, please notify me.
我的问题是我正在尝试安装django-templatesated-email包,以便我可以使用mailchimp从我的应用发送电子邮件,我下载了,并按照说明(使用项目根文件夹中的pip指令),但是当我添加:
My problem is that I'm trying to install django-templated-email package so I can send emails from my app using mailchimp, I downloaded https://github.com/bradwhittington/django-templated-email and followed the instructions (used the pip instruction from project root folder), but, when I add:
from templated_email.backends.vanilla_django import TemplateBackend
TEMPLATED_EMAIL_BACKEND = TemplateBackend
我的settings.py,我试图运行本地服务器时出现此错误:
to my settings.py, I get this error when trying to run local server:
ImportError: Could not import settings 'proyect.settings' (Is it on sys.path?): No module named templated_email.backends.vanilla_django
我读过它开箱的,所以我就可以删除这些行,仍然可以得到包的工作(或者至少这是我的理解)。在添加此当我真正的问题是我的 views.py 的,所以我可以使用软件包:
I've read it works out of the box, so I just can delete these rows and still get the package to work (or at least that's what I understand). My real problem comes when adding this in my views.py so I can use the package:
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其中I添加导入行
It's in line 1316 where I add the import line
希望您能帮我解决问题,以便我可以开始发送电子邮件和通讯!
Hope you can help me solve my problem so I can start sending emails and newsletters!
推荐答案
您在您的python路径中添加了 / Users / xxxxx / xxxx / proyect / proyect
,但未添加 /用户/ XXXXX / XXXX / proyect
You added /Users/xxxxx/xxxx/proyect/proyect
in your python path but not added /Users/xxxxx/xxxx/proyect
这篇关于安装django-templatesated-email的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!