2013-01-12 52 views
1

我正在學習如何在Django中開發,所以還有很多事情我仍然需要學習,所以,如果我有任何概念錯誤,請通知我。我下載了https://github.com/bradwhittington/django-templated-email,並按照指示(使用項目根文件夾中的pip指令),但是我試圖安裝django-templated-email包,以便我可以使用mailchimp從我的應用程序發送電子郵件,不過, ,當我添加:安裝django-templated-email

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行,我添加導入行

希望你能幫助我解決我的問題,所以我可以開始發送電子郵件和通訊!

回答

1

你在你的Python路徑添加/Users/xxxxx/xxxx/proyect/proyect,但沒有添加/Users/xxxxx/xxxx/proyect

+0

謝謝,這解決了我的問題,settings.py,但我仍然有問題白衣views.py線 – Sascuash

+0

這是我擔心的:異常值: 沒有名爲templated_email的模塊 – Sascuash